[FIX] pos_loyalty: use float_compare to compare points
After this commit, we will be using float_compare function to compare points. This will ensure that any floating point errors are properly handled and that we receive correct responses from the `validate_coupon_programs` function. opw-3264681 closes odoo/odoo#118829 X-original-commit: 48013733a6e8b655cbc81211b1010e76102b9c2a Signed-off-by: Heinz Robin (rhe) <rhe@odoo.com> Signed-off-by: Pedram Bi Ria (pebr) <pebr@odoo.com>
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
from collections import defaultdict
|
||||
from odoo import _, models
|
||||
from odoo.tools import float_compare
|
||||
import base64
|
||||
|
||||
class PosOrder(models.Model):
|
||||
@@ -28,7 +29,7 @@ class PosOrder(models.Model):
|
||||
}
|
||||
}
|
||||
for coupon in coupons:
|
||||
if (coupon.points + point_changes[coupon.id]) < 0:
|
||||
if float_compare(coupon.points, -point_changes[coupon.id], 2) == -1:
|
||||
return {
|
||||
'successful': False,
|
||||
'payload': {
|
||||
|
||||
Reference in New Issue
Block a user