Skip to content

Commit 268a475

Browse files
committed
[FIX] estate: use float_compare helper for float comparison
1 parent 852f056 commit 268a475

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

estate/models/estate_property_offer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from dateutil.relativedelta import relativedelta
44
from odoo import api, fields, models, _
55
from odoo.exceptions import UserError
6+
from odoo.tools.float_utils import float_compare
67

78

89
class EstatePropertyOffer(models.Model):
@@ -40,7 +41,7 @@ def create(self, vals):
4041
for val in vals:
4142
estate_property = self.env["estate.property"].browse(val["property_id"])
4243
best_price = estate_property.best_price or 0.0
43-
if val["price"] < best_price:
44+
if float_compare(val["price"], best_price, precision_digits=2) < 0:
4445
raise UserError(_("A new offer must match or exceed the price of the current best offer."))
4546
estate_property.state = "offer_received"
4647
return super().create(vals)

0 commit comments

Comments
 (0)