From d7099e7c13cf60303dd78bdeddc711f76d93d063 Mon Sep 17 00:00:00 2001 From: Smit Vora Date: Fri, 20 Dec 2024 17:20:08 +0530 Subject: [PATCH 1/2] fix: set recon status for match found in purchase reco tool --- .../purchase_reconciliation_tool.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/india_compliance/gst_india/doctype/purchase_reconciliation_tool/purchase_reconciliation_tool.py b/india_compliance/gst_india/doctype/purchase_reconciliation_tool/purchase_reconciliation_tool.py index ebb090c2e..e9dc84c18 100644 --- a/india_compliance/gst_india/doctype/purchase_reconciliation_tool/purchase_reconciliation_tool.py +++ b/india_compliance/gst_india/doctype/purchase_reconciliation_tool/purchase_reconciliation_tool.py @@ -267,6 +267,9 @@ def link_documents(self, purchase_invoice_name, inward_supply_name, link_doctype inward_supplies.append(inward_supply_name) self.db_set("is_modified", 1) + self.set_reconciliation_status( + link_doctype, [purchase_invoice_name], "Match Found" + ) return self.ReconciledData.get(purchases, inward_supplies) From aa0477a7324c2d016e47e69ade3355c363467852 Mon Sep 17 00:00:00 2001 From: Smit Vora Date: Fri, 20 Dec 2024 17:38:45 +0530 Subject: [PATCH 2/2] fix: patch recinciliation status for manually updating the data --- india_compliance/patches.txt | 1 + ..._reconciliation_status_for_manual_match.py | 26 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 india_compliance/patches/v14/set_reconciliation_status_for_manual_match.py diff --git a/india_compliance/patches.txt b/india_compliance/patches.txt index 37fa0ca3d..328e89de8 100644 --- a/india_compliance/patches.txt +++ b/india_compliance/patches.txt @@ -55,6 +55,7 @@ india_compliance.patches.v14.update_item_gst_details_and_gst_trearment_in_bill_o india_compliance.patches.v14.update_default_auto_reconciliation_settings india_compliance.patches.v14.update_default_gstr1_settings india_compliance.patches.v14.stop_unnecessary_scheduled_jobs +india_compliance.patches.v14.set_reconciliation_status_for_manual_match india_compliance.patches.v14.add_match_found_in_purchase_reconciliation_status india_compliance.patches.v14.unset_inward_supply_link_for_cancelled_purchase india_compliance.patches.v14.delete_not_generated_gstr_import_log diff --git a/india_compliance/patches/v14/set_reconciliation_status_for_manual_match.py b/india_compliance/patches/v14/set_reconciliation_status_for_manual_match.py new file mode 100644 index 000000000..ae68c032f --- /dev/null +++ b/india_compliance/patches/v14/set_reconciliation_status_for_manual_match.py @@ -0,0 +1,26 @@ +import frappe + + +def execute(): + """ + Match status was not being updated when manually matched. This patch will update the reconciliation status. + """ + inward_supply = frappe.qb.DocType("GST Inward Supply") + docs = ( + frappe.qb.from_(inward_supply) + .select(inward_supply.link_doctype, inward_supply.link_name) + .where(inward_supply.link_doctype.isin(("Purchase Invoice", "Bill of Entry"))) + .where(inward_supply.action == "No Action") # status updated on action + .where(inward_supply.match_status == "Manual Match") + .run(as_dict=True) + ) + + docs_to_update = {} + + for doc in docs: + docs_to_update.setdefault(doc.link_doctype, []).append(doc.link_name) + + for doctype, doc_names in docs_to_update.items(): + frappe.db.set_value( + doctype, {"name": ("in", doc_names)}, "reconciliation_status", "Match Found" + )