diff --git a/lending/loan_management/doctype/loan_repayment_schedule/loan_repayment_schedule.py b/lending/loan_management/doctype/loan_repayment_schedule/loan_repayment_schedule.py index 8c431cd8..da84680d 100644 --- a/lending/loan_management/doctype/loan_repayment_schedule/loan_repayment_schedule.py +++ b/lending/loan_management/doctype/loan_repayment_schedule/loan_repayment_schedule.py @@ -179,6 +179,8 @@ def on_cancel(self): self.ignore_linked_doctypes = ["Loan Interest Accrual", "Loan Demand"] + self.db_set("status", "Cancelled") + def set_repayment_period(self): if self.repayment_frequency == "One Time": self.repayment_method = "Repay Over Number of Periods" diff --git a/lending/loan_management/doctype/process_loan_classification/process_loan_classification.py b/lending/loan_management/doctype/process_loan_classification/process_loan_classification.py index c27f12fd..3abe0a7f 100644 --- a/lending/loan_management/doctype/process_loan_classification/process_loan_classification.py +++ b/lending/loan_management/doctype/process_loan_classification/process_loan_classification.py @@ -33,7 +33,7 @@ def on_submit(self): self.name, self.payment_reference, self.is_backdated, - self.force_update_dpd_in_loan + self.force_update_dpd_in_loan, ) else: BATCH_SIZE = 5000 @@ -76,7 +76,7 @@ def process_loan_classification_batch( ignore_freeze=True if payment_reference else False, is_backdated=is_backdated, via_background_job=via_scheduler, - force_update_dpd_in_loan=force_update_dpd_in_loan + force_update_dpd_in_loan=force_update_dpd_in_loan, ) if len(open_loans) > 1: diff --git a/lending/patches.txt b/lending/patches.txt index a4bc5d29..7ff7260b 100644 --- a/lending/patches.txt +++ b/lending/patches.txt @@ -34,4 +34,5 @@ lending.patches.v15_0.rename_irac_provisioning_configuration_loan_product lending.patches.v15_0.update_loan_product_accounts #lending.patches.v15_0.loan_interest_accrual_changes lending.patches.v15_0.create_accounting_dimensions_for_loan_doctypes -lending.patches.v15_0.update_maturity_date \ No newline at end of file +lending.patches.v15_0.update_maturity_date +lending.patches.v15_0.loan_repayment_schedule_status_patch diff --git a/lending/patches/v15_0/loan_repayment_schedule_status_patch.py b/lending/patches/v15_0/loan_repayment_schedule_status_patch.py new file mode 100644 index 00000000..dbaa5176 --- /dev/null +++ b/lending/patches/v15_0/loan_repayment_schedule_status_patch.py @@ -0,0 +1,10 @@ +import frappe +from frappe.query_builder import DocType + + +def execute(): + LoanRepaymentSchedule = DocType("Loan Repayment Schedule") + + frappe.qb.update(LoanRepaymentSchedule).set(LoanRepaymentSchedule.status, "Cancelled").where( + (LoanRepaymentSchedule.docstatus == 2) & (LoanRepaymentSchedule.status != "Cancelled") + ).run()