fix: precision of total penalty paid

(cherry picked from commit 9a86885c0a)
This commit is contained in:
Abhinav Raut
2022-05-13 17:55:16 +05:30
committed by Mergify
parent e958ef26e0
commit 5c45737a8f

View File

@@ -265,6 +265,7 @@ class LoanRepayment(AccountsController):
regenerate_repayment_schedule(self.against_loan, cancel)
def allocate_amounts(self, repayment_details):
precision = 2
self.set("repayment_details", [])
self.principal_amount_paid = 0
self.total_penalty_paid = 0
@@ -279,9 +280,9 @@ class LoanRepayment(AccountsController):
if interest_paid > 0:
if self.penalty_amount and interest_paid > self.penalty_amount:
self.total_penalty_paid = flt(self.penalty_amount, self.precision("debit"))
self.total_penalty_paid = flt(self.penalty_amount, precision)
elif self.penalty_amount:
self.total_penalty_paid = flt(interest_paid, self.precision("debit"))
self.total_penalty_paid = flt(interest_paid, precision)
interest_paid -= self.total_penalty_paid