diff --git a/erpnext/accounts/doctype/bank_transaction/bank_transaction.py b/erpnext/accounts/doctype/bank_transaction/bank_transaction.py index de796be8df7aee1b0db8696bb6611853120de035..1363373e0e82678b0e7b9d170d3a5bde30e099fa 100644 --- a/erpnext/accounts/doctype/bank_transaction/bank_transaction.py +++ b/erpnext/accounts/doctype/bank_transaction/bank_transaction.py @@ -248,31 +248,20 @@ class BankTransaction(StatusUpdater): frappe.get_doc(payment.payment_document, payment.payment_entry).set_status(update=True) def set_allocation_in_bank_transaction(self): - allocated_amount = flt( - sum( - [ - flt(x.get("allocated_amount", 0)) * (1 if x.get("payment_type") == "Debit" else -1) - for x in self.payment_entries - ] - ) - if self.payment_entries - else 0, - self.precision("allocated_amount"), + allocated_amount = sum( + [ + flt(x.get("allocated_amount", 0)) * (1 if x.get("payment_type") == "Debit" else -1) + for x in self.payment_entries + ] ) transaction_amount = flt(self.credit) - flt(self.debit) - self.allocated_amount = ( - flt(allocated_amount, self.precision("allocated_amount")) if allocated_amount else 0 - ) - self.unallocated_amount = ( - flt(flt(transaction_amount) - flt(allocated_amount), self.precision("unallocated_amount")) - if allocated_amount - else flt(transaction_amount, self.precision("unallocated_amount")) - ) + self.allocated_amount = allocated_amount + + self.unallocated_amount = transaction_amount - allocated_amount - if self.unallocated_amount == 0.0: - self.status = "Reconciled" + self.round_floats_in(self, ["allocated_amount", "unallocated_amount"]) def check_reconciliation_amounts(self): for payment_entry in self.payment_entries: