Browse Source

[FIX] partner_industry_Secondary: Make api constrains multi to avoid error when create a company with 2 contacts

12.0
Sergio Teruel 5 years ago
parent
commit
49a6a89d76
  1. 3
      partner_industry_secondary/models/res_partner.py

3
partner_industry_secondary/models/res_partner.py

@ -17,7 +17,8 @@ class ResPartner(models.Model):
@api.constrains('industry_id', 'secondary_industry_ids')
def _check_industries(self):
if self.industry_id in self.secondary_industry_ids:
for partner in self:
if partner.industry_id in partner.secondary_industry_ids:
raise exceptions.ValidationError(
_('The main industry must be different '
'from the secondary industries.'))
Loading…
Cancel
Save