diff --git a/base_location/__manifest__.py b/base_location/__manifest__.py index e01879bc9..d7ffb5c8b 100644 --- a/base_location/__manifest__.py +++ b/base_location/__manifest__.py @@ -4,7 +4,7 @@ { 'name': 'Location management (aka Better ZIP)', - 'version': '12.0.1.0.1', + 'version': '12.0.1.0.2', 'depends': [ 'base_address_city', 'contacts', diff --git a/base_location/models/res_company.py b/base_location/models/res_company.py index 49548920b..f78642aa9 100644 --- a/base_location/models/res_company.py +++ b/base_location/models/res_company.py @@ -47,21 +47,11 @@ class ResCompany(models.Model): def _inverse_city_id(self): for company in self: - company.with_context( - skip_check_zip=True).partner_id.city_id = company.city_id + company.partner_id.city_id = company.city_id def _inverse_zip_id(self): for company in self: - company.with_context( - skip_check_zip=True).partner_id.zip_id = company.zip_id - - def _inverse_state(self): - return super(ResCompany, self.with_context( - skip_check_zip=True))._inverse_state() - - def _inverse_country(self): - return super(ResCompany, self.with_context( - skip_check_zip=True))._inverse_country() + company.partner_id.zip_id = company.zip_id @api.onchange('zip_id') def _onchange_zip_id(self): diff --git a/base_location/models/res_partner.py b/base_location/models/res_partner.py index e4d38b079..15e64ad00 100644 --- a/base_location/models/res_partner.py +++ b/base_location/models/res_partner.py @@ -50,26 +50,6 @@ class ResPartner(models.Model): vals.update({'state_id': self.zip_id.city_id.state_id}) self.update(vals) - @api.constrains('zip_id', 'country_id', 'city_id', 'state_id') - def _check_zip(self): - if self.env.context.get('skip_check_zip'): - return - for rec in self: - if not rec.zip_id: - continue - if rec.zip_id.city_id.state_id != rec.state_id: - raise ValidationError(_( - "The state of the partner %s differs from that in " - "location %s") % (rec.name, rec.zip_id.name)) - if rec.zip_id.city_id.country_id != rec.country_id: - raise ValidationError(_( - "The country of the partner %s differs from that in " - "location %s") % (rec.name, rec.zip_id.name)) - if rec.zip_id.city_id != rec.city_id: - raise ValidationError(_( - "The city of partner %s differs from that in " - "location %s") % (rec.name, rec.zip_id.name)) - @api.onchange('state_id') def _onchange_state_id(self): vals = {}