Consider refund_amount in pending principal amount
diff --git a/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py b/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py
index 7b0028d..e7d6ca8 100644
--- a/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py
+++ b/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py
@@ -396,7 +396,7 @@
)
else:
remarks = "Repayment against loan " + self.against_loan
-
+
if self.reference_number:
remarks += "with reference no. {}".format(self.reference_number)
@@ -632,6 +632,7 @@
- flt(loan.total_principal_paid)
- flt(loan.total_interest_payable)
- flt(loan.written_off_amount)
+ + flt(loan.refund_amount)
)
else:
pending_principal_amount = (
@@ -641,6 +642,7 @@
- flt(loan.total_principal_paid)
- flt(loan.total_interest_payable)
- flt(loan.written_off_amount)
+ + flt(loan.refund_amount)
)
return pending_principal_amount