From 2403cdc4d7ed51f48452197942742020b688cc00 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2025 11:16:09 +0530 Subject: [PATCH] fix: System was allowing to save payment schedule amount less than grand total (backport #45322) (#45381) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix: System was allowing to save payment schedule amount less than grand total (#45322) * fix: System was allowing to save payment schedule amount less than grand_total * style: After run pre-commit (cherry picked from commit b26f0b6633829405a5cbb884ceec7b5352291850) Co-authored-by: Diógenes Souza <103958767+devdiogenes@users.noreply.github.com> --- erpnext/controllers/accounts_controller.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 7074710dfee..db51a012db6 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -2413,10 +2413,15 @@ class AccountsController(TransactionBase): ) if ( - flt(total, self.precision("grand_total")) - flt(grand_total, self.precision("grand_total")) + abs( + flt(total, self.precision("grand_total")) + - flt(grand_total, self.precision("grand_total")) + ) > 0.1 - or flt(base_total, self.precision("base_grand_total")) - - flt(base_grand_total, self.precision("base_grand_total")) + or abs( + flt(base_total, self.precision("base_grand_total")) + - flt(base_grand_total, self.precision("base_grand_total")) + ) > 0.1 ): frappe.throw(