From d63fbd79f4f434e3a6d925832d114c9f2b930442 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Mon, 26 Oct 2020 14:20:55 +0530 Subject: [PATCH] fix: Unaccrued interest from last accrual date instead of disbursement date --- .../loan_management/doctype/loan_repayment/loan_repayment.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py b/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py index b973cd69e6..c1e83d9305 100644 --- a/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py +++ b/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py @@ -310,6 +310,7 @@ def get_accrued_interest_entries(against_loan): payable_principal_amount - paid_principal_amount > 0) AND docstatus = 1 + ORDER BY posting_date """, (against_loan), as_dict=1) return unpaid_accrued_entries @@ -366,7 +367,8 @@ def get_amounts(amounts, against_loan, posting_date): if due_date: pending_days = date_diff(posting_date, due_date) + 1 else: - pending_days = date_diff(posting_date, against_loan_doc.disbursement_date) + 1 + last_accrual_date = get_last_accural_date(against_loan_doc.name) + pending_days = date_diff(posting_date, last_accrual_date) + 1 if pending_days > 0: principal_amount = flt(pending_principal_amount, precision)