Skip to content

Commit

Permalink
fix: repayment schedule regeneration
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhinav Raut committed Nov 7, 2022
1 parent 30daeb9 commit d6ab2b3
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -576,18 +576,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 d6ab2b3

Please sign in to comment.