You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
878 B
23 lines
878 B
# -*- coding: utf-8 -*-
|
|
# © 2015 Antiun Ingenieria S.L. - Javier Iniesta
|
|
# © 2016 Tecnativa S.L. - Vicent Cubells
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
|
|
|
from openerp import models, fields, api, exceptions, _
|
|
|
|
|
|
class ResPartner(models.Model):
|
|
_inherit = 'res.partner'
|
|
|
|
sector_id = fields.Many2one(comodel_name='res.partner.sector',
|
|
string='Main Sector')
|
|
|
|
secondary_sector_ids = fields.Many2many(
|
|
comodel_name='res.partner.sector', string="Secondary Sectors",
|
|
domain="[('id', '!=', sector_id)]")
|
|
|
|
@api.constrains('sector_id', 'secondary_sector_ids')
|
|
def _check_sectors(self):
|
|
if self.sector_id in self.secondary_sector_ids:
|
|
raise exceptions.Warning(_('The main sector must be different '
|
|
'from the secondary sectors.'))
|