Browse Source

[FIX] restore computed field

- select=1 is not usable anymore ...
pull/347/head
Nicolas JEUDY 8 years ago
parent
commit
da797edd1d
  1. 4
      partner_contact_in_several_companies/models/res_partner.py

4
partner_contact_in_several_companies/models/res_partner.py

@ -12,6 +12,8 @@ class ResPartner(models.Model):
[('standalone', _('Standalone Contact')), [('standalone', _('Standalone Contact')),
('attached', _('Attached to existing Contact')), ('attached', _('Attached to existing Contact')),
], ],
comptute='_get_contact_type',
store=True,
required=True, required=True,
default='standalone') default='standalone')
contact_id = fields.Many2one('res.partner', string='Main Contact', contact_id = fields.Many2one('res.partner', string='Main Contact',
@ -22,7 +24,7 @@ class ResPartner(models.Model):
other_contact_ids = fields.One2many('res.partner', 'contact_id', other_contact_ids = fields.One2many('res.partner', 'contact_id',
string='Others Positions') string='Others Positions')
@api.onchange('contact_id')
@api.depends('contact_id')
def _get_contact_type(self): def _get_contact_type(self):
for record in self: for record in self:
record.contact_type = record.contact_id and 'attached' or 'standalone' record.contact_type = record.contact_id and 'attached' or 'standalone'

Loading…
Cancel
Save