From fbc0c1f41e222a7bc23e422f8175ed7c9da61432 Mon Sep 17 00:00:00 2001 From: sesn-odoo Date: Thu, 4 Jan 2024 09:57:54 +0100 Subject: [PATCH] [FIX] account: correctly compare floats MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit opw-3641270 closes odoo/odoo#148369 X-original-commit: 1a6aa05081e900731fc7821b1582985e545a542a Signed-off-by: Laurent Smet (las) Signed-off-by: Séna Serge Nshimiyimana (sesn) --- addons/account/models/account_move.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 6d87db7d72e..d0a9d1d98cb 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -3694,7 +3694,11 @@ class AccountMove(models.Model): raise AccessError(_("You don't have the access rights to post an invoice.")) for invoice in self.filtered(lambda move: move.is_invoice(include_receipts=True)): - if invoice.quick_edit_mode and invoice.quick_edit_total_amount and invoice.quick_edit_total_amount != invoice.amount_total: + if ( + invoice.quick_edit_mode + and invoice.quick_edit_total_amount + and invoice.currency_id.compare_amounts(invoice.quick_edit_total_amount, invoice.amount_total) != 0 + ): raise UserError(_( "The current total is %s but the expected total is %s. In order to post the invoice/bill, " "you can adjust its lines or the expected Total (tax inc.).",