@@ -85,28 +85,8 @@ class L10nEsAeatRealEstate(models.Model):
8585 )
8686 state_id = fields .Many2one (
8787 comodel_name = "res.country.state" ,
88- compute = "_compute_state_id" ,
89- readonly = False ,
90- store = True ,
91- )
92- state_code = fields .Char (
93- compute = "_compute_state_code" ,
94- store = True ,
95- readonly = False ,
96- compute_sudo = True ,
97- )
98- city_id = fields .Many2one (
99- comodel_name = "res.city" ,
100- string = "City ID" ,
101- index = True ,
102- compute = "_compute_city_id" ,
103- readonly = False ,
104- store = True ,
10588 )
10689 city = fields .Char (
107- compute = "_compute_city" ,
108- store = True ,
109- readonly = False ,
11090 size = 30 ,
11191 required = True ,
11292 )
@@ -153,20 +133,12 @@ def _compute_representative_vat(self):
153133 for record in self :
154134 record .representative_vat = record .partner_id .vat
155135
156- @api .depends ("city_id" )
157- def _compute_city (self ):
158- for record in self :
159- if record .city_id and record .city_id .name :
160- record .city = record .city_id .name
161- else :
162- record .city = ""
163-
164- @api .depends ("state_code" )
136+ @api .depends ("state_id" )
165137 def _compute_check_ok (self ):
166138 self .update ({"check_ok" : False , "error_text" : False })
167139 for record in self :
168140 errors = []
169- if not record .state_code :
141+ if not record .state_id :
170142 errors .append (self .env ._ ("Without state" ))
171143 record .check_ok = not bool (errors )
172144 record .error_text = bool (errors ) and ", " .join (errors )
0 commit comments