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.
31 lines
1.0 KiB
31 lines
1.0 KiB
# -*- coding: utf-8 -*-
|
|
# © 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
|
|
|
|
|
from odoo import models, api
|
|
from .. import fields
|
|
|
|
|
|
class ResPartner(models.Model):
|
|
_inherit = 'res.partner'
|
|
_phone_name_sequence = 10
|
|
|
|
phone = fields.Phone(country_field='country_id', partner_field='parent_id')
|
|
mobile = fields.Phone(
|
|
country_field='country_id', partner_field='parent_id')
|
|
fax = fields.Fax(country_field='country_id', partner_field='parent_id')
|
|
|
|
@api.multi
|
|
def name_get(self):
|
|
if self._context.get('callerid'):
|
|
res = []
|
|
for partner in self:
|
|
if partner.parent_id and partner.parent_id.is_company:
|
|
name = u'%s (%s)' % (partner.name, partner.parent_id.name)
|
|
else:
|
|
name = partner.name
|
|
res.append((partner.id, name))
|
|
return res
|
|
else:
|
|
return super(ResPartner, self).name_get()
|