Add ACL + name_get() for one2many_phone module

This commit is contained in:
Alexis de Lattre
2017-08-31 10:30:01 +02:00
parent 748614ba34
commit 2ebdc8e329
2 changed files with 14 additions and 0 deletions

View File

@@ -28,6 +28,19 @@ class ResPartnerPhone(models.Model):
phone = Phone('Phone', required=True, partner_field='partner_id')
note = fields.Char('Note')
def name_get(self):
res = []
for pphone in self:
if pphone.partner_id:
if self._context.get('callerid'):
name = pphone.partner_id.name_get()[0][1]
else:
name = u'%s (%s)' % (pphone.phone, pphone.partner_id.name)
else:
name = pphone.phone
res.append((pphone.id, name))
return res
class ResPartner(models.Model):
_inherit = 'res.partner'