Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: set reconciliation status for unlinked document in purchase reco tool (backport #2930) #2937

Merged
merged 2 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading