From b0d67517778daa3a5f527c7729c9862b1194d36e Mon Sep 17 00:00:00 2001 From: ravibharathi656 Date: Thu, 29 Jan 2026 16:05:22 +0530 Subject: [PATCH] fix(payment entry): round unallocated amount --- .../doctype/payment_entry/payment_entry.py | 32 +++++++++++++------ 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index b0d754a3f23..12bede1219a 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -1081,20 +1081,32 @@ class PaymentEntry(AccountsController): self.base_paid_amount + deductions_to_consider ): self.unallocated_amount = ( - self.base_paid_amount - + deductions_to_consider - - self.base_total_allocated_amount - - included_taxes - ) / self.source_exchange_rate + flt( + ( + self.base_paid_amount + + deductions_to_consider + - self.base_total_allocated_amount + - included_taxes + ), + self.precision("unallocated_amount"), + ) + / self.source_exchange_rate + ) elif self.payment_type == "Pay" and self.base_total_allocated_amount < ( self.base_received_amount - deductions_to_consider ): self.unallocated_amount = ( - self.base_received_amount - - deductions_to_consider - - self.base_total_allocated_amount - - included_taxes - ) / self.target_exchange_rate + flt( + ( + self.base_received_amount + - deductions_to_consider + - self.base_total_allocated_amount + - included_taxes + ), + self.precision("unallocated_amount"), + ) + / self.target_exchange_rate + ) def set_exchange_gain_loss(self): exchange_gain_loss = flt(