Skip to content

Commit 0f37c35

Browse files
committed
[FIX] estate: fixed depreciated sql contraint
-Implemented new sql constraint method.
1 parent e463e5c commit 0f37c35

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

estate/models/estate_property.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,15 @@ def action_sold(self):
9595
raise UserError("A cancelled property cannot be set as sold")
9696
record.state = "sold"
9797

98-
_constraints = [
99-
models.CheckConstraint(
100-
"expected_price > 0",
101-
message="The expected price must be strictly positive.",
102-
),
103-
models.CheckConstraint(
104-
"selling_price >= 0",
105-
message="The selling price must be positive.",
106-
),
107-
]
98+
_check_expected_price = models.Constraint(
99+
'CHECK(expected_price > 0)',
100+
'The expected price of a property must be strictly positive.'
101+
)
102+
103+
_check_selling_price = models.Constraint(
104+
'CHECK(selling_price > 0)',
105+
'The selling price of a property must be positive.'
106+
)
108107

109108
@api.constrains("selling_price", "expected_price")
110109
def _check_selling_price_ratio(self):

0 commit comments

Comments
 (0)