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.
25 lines
659 B
25 lines
659 B
# -*- coding: utf-8 -*-
|
|
# © 2016 Daniel Reis
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
|
|
|
from openerp import models, fields, api
|
|
|
|
|
|
class ResPartner(models.Model):
|
|
_inherit = 'res.partner'
|
|
|
|
lau1_id = fields.Many2one(
|
|
'res.partner.lau',
|
|
'Local Admin. Unit 1',
|
|
domain=[('level', '=', 1)])
|
|
lau2_id = fields.Many2one(
|
|
'res.partner.lau',
|
|
'Local Admin. Unit 2',
|
|
domain=[('level', '=', 2)])
|
|
|
|
@api.multi
|
|
@api.onchange('lau1_id')
|
|
def _onchange_lau1(self):
|
|
for p in self:
|
|
if p.lau2_id and p.lau2_id.parent_id != p.lau1_id:
|
|
p.lau2_id = None
|