Skip to content

Commit

Permalink
Merge pull request #2937 from resilient-tech/mergify/bp/version-15-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 8aac3bb + 4ea05f6 commit ea5c656
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,12 @@ def get_all(self, additional_fields=None, names=None, only_names=False):

def get_unmatched(self, category):
gst_category = (
("Registered Regular", "Tax Deductor", "Input Service Distributor")
(
"Registered Regular",
"Tax Deductor",
"Tax Collector",
"Input Service Distributor",
)
if category in ("B2B", "CDNR", "ISD")
else ("SEZ", "Overseas", "UIN Holders")
)
Expand Down Expand Up @@ -412,7 +417,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 @@ -1227,6 +1232,7 @@ def guess_classification(doc):
"Overseas": "IMPG",
"UIN Holders": "B2B",
"Tax Deductor": "B2B",
"Tax Collector": "B2B",
"Input Service Distributor": "B2B",
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,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 @@ -268,7 +271,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 ea5c656

Please sign in to comment.