forked from resilient-tech/india-compliance
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
39 additions
and
28 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
31 changes: 20 additions & 11 deletions
31
india_compliance/patches/v14/add_match_found_in_purchase_reconciliation_status.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 |
---|---|---|
@@ -1,19 +1,28 @@ | ||
import frappe | ||
|
||
DOCTYPES = ("Purchase Invoice", "Bill of Entry") | ||
|
||
def execute(): | ||
pi_and_boe_list = frappe.get_all( | ||
"GST Inward Supply", | ||
filters={"action": "No Action", "link_name": ("!=", "")}, | ||
pluck="link_name", | ||
) | ||
if not pi_and_boe_list: | ||
return | ||
|
||
for doc in ("Purchase Invoice", "Bill of Entry"): | ||
def execute(): | ||
for doctype in DOCTYPES: | ||
docs = get_inward_supply(doctype) | ||
if not docs: | ||
continue | ||
frappe.db.set_value( | ||
doc, | ||
{"name": ("in", pi_and_boe_list)}, | ||
doctype, | ||
{"name": ("in", docs)}, | ||
"reconciliation_status", | ||
"Match Found", | ||
) | ||
|
||
|
||
def get_inward_supply(doctype): | ||
return frappe.get_all( | ||
"GST Inward Supply", | ||
filters={ | ||
"action": "No Action", | ||
"link_name": ("!=", ""), | ||
"link_doctype": doctype, | ||
}, | ||
pluck="link_name", | ||
) |