fix: Remove QI link on cancel wherever same QI name exists
This commit is contained in:
parent
c4963bfdb2
commit
b7637f49cd
@ -70,9 +70,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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user