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: loan repayment schedule status --patch #216

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 @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion lending/patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
lending.patches.v15_0.update_maturity_date
lending.patches.v15_0.loan_repayment_schedule_status_patch
10 changes: 10 additions & 0 deletions lending/patches/v15_0/loan_repayment_schedule_status_patch.py
Original file line number Diff line number Diff line change
@@ -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()
Loading