Skip to content

Commit 02ba9cb

Browse files
authored
Merge pull request #1 from akretion/16.0-mig-pos_payment_change
[FIX] use float_compare to compare floats
2 parents bfd1971 + 4fbf636 commit 02ba9cb

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Diff for: pos_payment_change/wizards/pos_payment_change_wizard.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
from odoo import _, api, fields, models
66
from odoo.exceptions import UserError
7+
from odoo.tools import float_compare
78

89

910
class PosPaymentChangeWizard(models.TransientModel):
@@ -62,7 +63,14 @@ def button_change_payment(self):
6263

6364
# Check if the total is correct
6465
total = sum(self.mapped("new_line_ids.amount"))
65-
if total != self.amount_total:
66+
if (
67+
float_compare(
68+
total,
69+
self.amount_total,
70+
precision_rounding=self.order_id.currency_id.rounding,
71+
)
72+
!= 0
73+
):
6674
raise UserError(
6775
_(
6876
"Differences between the two values for the POS"

0 commit comments

Comments
 (0)