-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: closed status in loan disbursement
- Loading branch information
1 parent
a0130ff
commit d98fdd1
Showing
2 changed files
with
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import frappe | ||
|
||
loan_dis = frappe.db.get_all( | ||
"Loan Disbursement", | ||
filters={"status": ["!=", "Closed"]}, | ||
fields=["name", "docstatus"], | ||
) | ||
for ld in loan_dis: | ||
if ld.docstatus == 0: | ||
frappe.db.set_value("Loan Disbursement", ld.name, "status", "Draft", update_modified=False) | ||
elif ld.docstatus == 1: | ||
frappe.db.set_value("Loan Disbursement", ld.name, "status", "Submitted", update_modified=False) | ||
elif ld.docstatus == 2: | ||
frappe.db.set_value("Loan Disbursement", ld.name, "status", "Cancelled", update_modified=False) | ||
|
||
loan_repay_sche = frappe.db.get_all( | ||
"Loan Repayment Schedule", | ||
filters={"status": "Closed"}, | ||
fields=["loan_disbursement"], | ||
) | ||
for lrs in loan_repay_sche: | ||
if lrs.loan_disbursement: | ||
frappe.db.set_value( | ||
"Loan Disbursement", lrs.loan_disbursement, "status", "Closed", update_modified=False | ||
) |