Skip to content

Commit

Permalink
Merge pull request #216 from Nihantra-Patel/patch_for_loan_repayment_…
Browse files Browse the repository at this point in the history
…scheduler_status

fix: loan repayment schedule status --patch
  • Loading branch information
deepeshgarg007 authored Dec 9, 2024
2 parents bfcec32 + 598c046 commit 3669e54
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
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()

0 comments on commit 3669e54

Please sign in to comment.