[FIX] account: correctly compare floats

opw-3641270

closes odoo/odoo#148369

X-original-commit: 1a6aa05081e900731fc7821b1582985e545a542a
Signed-off-by: Laurent Smet (las) <las@odoo.com>
Signed-off-by: Séna Serge Nshimiyimana (sesn) <sesn@odoo.com>
This commit is contained in:
sesn-odoo
2024-01-08 06:10:04 +00:00
parent 1c8a0824da
commit fbc0c1f41e
+5 -1
View File
@@ -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.).",