Skip to content

Commit

Permalink
Merge pull request #2936 from resilient-tech/mergify/bp/version-14-ho…
Browse files Browse the repository at this point in the history
…tfix/pr-2930

fix: set reconciliation status for unlinked document in purchase reco tool (backport #2930)
  • Loading branch information
mergify[bot] authored Jan 8, 2025
2 parents 07ba523 + d4bcf3b commit 8455e7d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ def get_all(self, additional_fields=None, names=None, only_names=False):

def get_unmatched(self, category):
gst_category = (
("Registered Regular", "Tax Deductor")
("Registered Regular", "Tax Deductor", "Tax Collector")
if category in ("B2B", "CDNR", "ISD")
else ("SEZ", "Overseas", "UIN Holders")
)
Expand Down Expand Up @@ -412,7 +412,7 @@ def get_query(self, additional_fields=None, is_return=False):
.on(self.PI_ITEM.parent == self.PI.name)
.where(self.PI.docstatus == 1)
.where(IfNull(self.PI.reconciliation_status, "") != "Not Applicable")
.where(self.PI.is_opening == "NO")
.where(self.PI.is_opening == "No")
.where(self.PI_ITEM.parenttype == "Purchase Invoice")
.groupby(self.PI.name)
.select(
Expand Down Expand Up @@ -1226,6 +1226,7 @@ def guess_classification(doc):
"Overseas": "IMPG",
"UIN Holders": "B2B",
"Tax Deductor": "B2B",
"Tax Collector": "B2B",
}

classification = GST_CATEGORIES.get(doc.gst_category)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,9 @@ def link_documents(self, purchase_invoice_name, inward_supply_name, link_doctype
if isup_linked_with := frappe.db.get_value(
"GST Inward Supply", inward_supply_name, "link_name"
):
self.set_reconciliation_status(
link_doctype, (isup_linked_with,), "Unreconciled"
)
self._unlink_documents((inward_supply_name,))
purchases.append(isup_linked_with)

Expand All @@ -258,7 +261,7 @@ def link_documents(self, purchase_invoice_name, inward_supply_name, link_doctype

self.db_set("is_modified", 1)
self.set_reconciliation_status(
link_doctype, [purchase_invoice_name], "Match Found"
link_doctype, (purchase_invoice_name,), "Match Found"
)

return self.ReconciledData.get(purchases, inward_supplies)
Expand Down

0 comments on commit 8455e7d

Please sign in to comment.