1
- from odoo import api , fields , models , _
1
+ from odoo import api , fields , models
2
2
from odoo .exceptions import UserError , ValidationError
3
3
from odoo .tools .float_utils import float_compare , float_is_zero
4
4
from dateutil .relativedelta import relativedelta
@@ -63,7 +63,7 @@ class EstateProperty(models.Model):
63
63
def _check_selling_price (self ):
64
64
for record in self :
65
65
if not float_is_zero (record .selling_price , precision_digits = 2 ) and float_compare (record .selling_price , record .expected_price * 0.9 , precision_digits = 2 ) <= 0 :
66
- raise ValidationError ("The selling price cannot be lower than 90 percent of the expected price." )
66
+ raise ValidationError (self . env . _ ( "The selling price cannot be lower than 90 percent of the expected price." ) )
67
67
68
68
69
69
@api .depends ('living_area' , 'garden_area' )
@@ -81,7 +81,7 @@ def _compute_best_price(self):
81
81
def _prevent_property_deletion (self ):
82
82
for record in self :
83
83
if record .state not in ('new' , 'cancelled' ):
84
- raise UserError (_ ("Only new or cancelled properties can be deleted." ))
84
+ raise UserError (self . env . _ ("Only new or cancelled properties can be deleted." ))
85
85
86
86
@api .onchange ('garden' )
87
87
def _onchange_garden (self ):
@@ -97,13 +97,13 @@ def action_set_sold(self):
97
97
if record .state != 'cancelled' :
98
98
record .state = 'sold'
99
99
else :
100
- raise UserError (_ ("Sold properties cannot be cancelled." ))
100
+ raise UserError (self . env . _ ("Sold properties cannot be cancelled." ))
101
101
return True
102
102
103
103
def action_set_cancelled (self ):
104
104
for record in self :
105
105
if record .state != 'sold' :
106
106
record .state = 'cancelled'
107
107
else :
108
- raise UserError (_ ("Sold properties cannot be cancelled." ))
108
+ raise UserError (self . env . _ ("Sold properties cannot be cancelled." ))
109
109
return True
0 commit comments