-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2895 from vorasmit/set-reco-status
- Loading branch information
Showing
3 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
india_compliance/patches/v14/set_reconciliation_status_for_manual_match.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
) |