diff --git a/india_compliance/gst_india/doctype/bill_of_entry/bill_of_entry.py b/india_compliance/gst_india/doctype/bill_of_entry/bill_of_entry.py index b1e18b8e69..c0f301b8c5 100644 --- a/india_compliance/gst_india/doctype/bill_of_entry/bill_of_entry.py +++ b/india_compliance/gst_india/doctype/bill_of_entry/bill_of_entry.py @@ -135,15 +135,19 @@ def on_cancel(self): self.ignore_linked_doctypes = ("GL Entry",) make_reverse_gl_entries(voucher_type=self.doctype, voucher_no=self.name) - if self.reconciliation_status == "Reconciled": - doc_name = frappe.get_value("GST Inward Supply", {"link_name": self.name}) - updated_data = { + if self.reconciliation_status != "Reconciled": + return + + frappe.db.set_value( + "GST Inward Supply", + {"link_doctype": "Bill of Entry", "link_name": self.name}, + { "match_status": "", "link_name": "", "link_doctype": "", "action": "No Action", - } - frappe.db.set_value("GST Inward Supply", doc_name, updated_data) + }, + ) # Code adapted from AccountsController.on_trash def on_trash(self): diff --git a/india_compliance/gst_india/overrides/purchase_invoice.py b/india_compliance/gst_india/overrides/purchase_invoice.py index 64492b0ff2..a0b82404b2 100644 --- a/india_compliance/gst_india/overrides/purchase_invoice.py +++ b/india_compliance/gst_india/overrides/purchase_invoice.py @@ -51,15 +51,19 @@ def validate(doc, method=None): def on_cancel(doc, method=None): - if doc.reconciliation_status == "Reconciled": - doc_name = frappe.get_value("GST Inward Supply", {"link_name": doc.name}) - updated_data = { + if doc.reconciliation_status != "Reconciled": + return + + frappe.db.set_value( + "GST Inward Supply", + {"link_doctype": "Purchase Invoice", "link_name": doc.name}, + { "match_status": "", "link_name": "", "link_doctype": "", "action": "No Action", - } - frappe.db.set_value("GST Inward Supply", doc_name, updated_data) + }, + ) def set_reconciliation_status(doc):