@@ -46,7 +46,7 @@ class EstateProperty(models.Model):
46
46
("sold" , "Sold" ),
47
47
("cancelled" , "Cancelled" ),
48
48
],
49
- string = "Status " ,
49
+ string = "State " ,
50
50
default = "new" ,
51
51
copy = False ,
52
52
)
@@ -98,16 +98,16 @@ class EstateProperty(models.Model):
98
98
@api .depends ("garden_area" , "living_area" )
99
99
def _compute_total_property_area (self ):
100
100
for area in self :
101
- self .total_area = self .garden_area + self .living_area
101
+ area .total_area = area .garden_area + area .living_area
102
102
103
103
@api .depends ("offer_ids.price" )
104
104
def _best_property_offer (self ):
105
105
for record in self :
106
106
offers_list = record .mapped ("offer_ids.price" )
107
107
if offers_list :
108
- self .best_price = max (offers_list )
108
+ record .best_price = max (offers_list )
109
109
return
110
- self .best_price = 0
110
+ record .best_price = 0
111
111
112
112
# on change of garden status , update gardern area and its orientation
113
113
@@ -127,7 +127,6 @@ def action_sell_property(self):
127
127
property_sell_status_dict = {"new" : True , "sold" : True , "cancelled" : False }
128
128
129
129
for record in self :
130
- print ("the object on sell action" , record .read ())
131
130
if property_sell_status_dict [record .status ]:
132
131
record .status = "sold"
133
132
record .state = "sold"
@@ -158,7 +157,7 @@ def _check_selling_price(self):
158
157
if data .selling_price <= 0 :
159
158
return
160
159
161
- price_float_ratio = data .selling_price / self .expected_price
160
+ price_float_ratio = data .selling_price / data .expected_price
162
161
ratio_diffrence = float_compare (price_float_ratio , 0.9 , precision_digits = 2 )
163
162
if ratio_diffrence == - 1 :
164
163
data .selling_price = 0
@@ -172,7 +171,7 @@ def _check_selling_price(self):
172
171
@api .ondelete (at_uninstall = False )
173
172
def _unlink_if_state_new_or_cancelled (self ):
174
173
for data in self :
175
- if not bool (self .state == "new" or self .state == "cancelled" ):
174
+ if not bool (data .state == "new" or data .state == "cancelled" ):
176
175
raise UserError (
177
176
"Can't delete property which is not in new or cancelled state!"
178
177
)
0 commit comments