[FIX] account: cash rounding float check

Fixup of 5cb044dd8a2385c9a3c09520ed97eb4faa39216d
We should use float_compare when working with float amounts as the
standard == may give wrong results

opw-3389449

closes odoo/odoo#127684

X-original-commit: 91f970fdfd8136e303b7052d690d8997f0278f24
Signed-off-by: John Laterre (jol) <jol@odoo.com>
This commit is contained in:
Andrea Grazioso (agr-odoo)
2023-07-07 09:42:21 +02:00
parent e762e15590
commit ffbfab098d
+2 -2
View File
@@ -2002,8 +2002,8 @@ class AccountMove(models.Model):
# No update needed
if existing_cash_rounding_line \
and existing_cash_rounding_line.balance == diff_balance \
and existing_cash_rounding_line.amount_currency == diff_amount_currency:
and float_compare(existing_cash_rounding_line.balance, diff_balance, precision_rounding=self.currency_id.rounding) == 0 \
and float_compare(existing_cash_rounding_line.amount_currency, diff_amount_currency, precision_rounding=self.currency_id.rounding) == 0:
return
_apply_cash_rounding(self, diff_balance, diff_amount_currency, existing_cash_rounding_line)