mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-07 15:12:51 +00:00
fix: Remove QI link on cancel wherever same QI name exists
This commit is contained in:
@@ -53,9 +53,12 @@ class QualityInspection(Document):
|
|||||||
|
|
||||||
if self.reference_type and self.reference_name:
|
if self.reference_type and self.reference_name:
|
||||||
conditions = ""
|
conditions = ""
|
||||||
if self.batch_no:
|
if self.batch_no and self.docstatus == 1:
|
||||||
conditions += " and t1.batch_no = '%s'"%(self.batch_no)
|
conditions += " and t1.batch_no = '%s'"%(self.batch_no)
|
||||||
|
|
||||||
|
if self.docstatus == 2: # if cancel, then remove qi link wherever same name
|
||||||
|
conditions += " and t1.quality_inspection = '%s'"%(self.name)
|
||||||
|
|
||||||
frappe.db.sql("""
|
frappe.db.sql("""
|
||||||
UPDATE
|
UPDATE
|
||||||
`tab{child_doc}` t1, `tab{parent_doc}` t2
|
`tab{child_doc}` t1, `tab{parent_doc}` t2
|
||||||
|
|||||||
Reference in New Issue
Block a user