mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 16:34:46 +00:00
Merge pull request #24368 from marination/qc-back-update-se-hotfix
fix: Back Update from QC based on Batch No
This commit is contained in:
@@ -52,10 +52,24 @@ class QualityInspection(Document):
|
|||||||
doctype = 'Stock Entry Detail'
|
doctype = 'Stock Entry Detail'
|
||||||
|
|
||||||
if self.reference_type and self.reference_name:
|
if self.reference_type and self.reference_name:
|
||||||
frappe.db.sql("""update `tab{child_doc}` t1, `tab{parent_doc}` t2
|
conditions = ""
|
||||||
set t1.quality_inspection = %s, t2.modified = %s
|
if self.batch_no and self.docstatus == 1:
|
||||||
where t1.parent = %s and t1.item_code = %s and t1.parent = t2.name"""
|
conditions += " and t1.batch_no = '%s'"%(self.batch_no)
|
||||||
.format(parent_doc=self.reference_type, child_doc=doctype),
|
|
||||||
|
if self.docstatus == 2: # if cancel, then remove qi link wherever same name
|
||||||
|
conditions += " and t1.quality_inspection = '%s'"%(self.name)
|
||||||
|
|
||||||
|
frappe.db.sql("""
|
||||||
|
UPDATE
|
||||||
|
`tab{child_doc}` t1, `tab{parent_doc}` t2
|
||||||
|
SET
|
||||||
|
t1.quality_inspection = %s, t2.modified = %s
|
||||||
|
WHERE
|
||||||
|
t1.parent = %s
|
||||||
|
and t1.item_code = %s
|
||||||
|
and t1.parent = t2.name
|
||||||
|
{conditions}
|
||||||
|
""".format(parent_doc=self.reference_type, child_doc=doctype, conditions=conditions),
|
||||||
(quality_inspection, self.modified, self.reference_name, self.item_code))
|
(quality_inspection, self.modified, self.reference_name, self.item_code))
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
|
|||||||
Reference in New Issue
Block a user