Skip to content

Commit

Permalink
Merge pull request #2895 from vorasmit/set-reco-status
Browse files Browse the repository at this point in the history
  • Loading branch information
vorasmit authored Dec 20, 2024
2 parents bdc856d + aa0477a commit 5f227b2
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 1 addition & 0 deletions india_compliance/patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
)

0 comments on commit 5f227b2

Please sign in to comment.