Skip to content

Commit

Permalink
fix: repayment schedule regeneration
Browse files Browse the repository at this point in the history
(cherry picked from commit d6ab2b3)
  • Loading branch information
Abhinav Raut authored and mergify[bot] committed Nov 11, 2022
1 parent de68674 commit 2f5033b
Showing 1 changed file with 4 additions and 4 deletions.
Expand Up @@ -573,18 +573,18 @@ def regenerate_repayment_schedule(loan, cancel=0):
loan_doc = frappe.get_doc("Loan", loan)
next_accrual_date = None
accrued_entries = 0
last_repayment_amount = 0
last_balance_amount = 0
last_repayment_amount = None
last_balance_amount = None

for term in reversed(loan_doc.get("repayment_schedule")):
if not term.is_accrued:
next_accrual_date = term.payment_date
loan_doc.remove(term)
else:
accrued_entries += 1
if not last_repayment_amount:
if last_repayment_amount is None:
last_repayment_amount = term.total_payment
if not last_balance_amount:
if last_balance_amount is None:
last_balance_amount = term.balance_loan_amount

loan_doc.save()
Expand Down

0 comments on commit 2f5033b

Please sign in to comment.