From 8a702a633883408cd41572c19dd157f8211ea905 Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Thu, 15 Feb 2024 19:48:54 +0100 Subject: [PATCH] fix(Bank Transaction): precision for `(un)allocated_amount` --- .../accounts/doctype/bank_transaction/bank_transaction.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/bank_transaction/bank_transaction.py b/erpnext/accounts/doctype/bank_transaction/bank_transaction.py index fef3b569ed..5e17881b6c 100644 --- a/erpnext/accounts/doctype/bank_transaction/bank_transaction.py +++ b/erpnext/accounts/doctype/bank_transaction/bank_transaction.py @@ -94,10 +94,13 @@ class BankTransaction(Document): pe.append(reference) def update_allocated_amount(self): - self.allocated_amount = ( + allocated_amount = ( sum(p.allocated_amount for p in self.payment_entries) if self.payment_entries else 0.0 ) - self.unallocated_amount = abs(flt(self.withdrawal) - flt(self.deposit)) - self.allocated_amount + unallocated_amount = abs(flt(self.withdrawal) - flt(self.deposit)) - allocated_amount + + self.allocated_amount = flt(allocated_amount, self.precision("allocated_amount")) + self.unallocated_amount = flt(unallocated_amount, self.precision("unallocated_amount")) def before_submit(self): self.allocate_payment_entries()