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.

30 lines
1000 B

  1. # -*- coding: utf-8 -*-
  2. # © 2012-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  4. from openerp import models, api
  5. from openerp.addons.base_phone.fields import Phone
  6. class HrApplicant(models.Model):
  7. _inherit = 'hr.applicant'
  8. _phone_name_sequence = 50
  9. partner_phone = Phone(partner_field='partner_id')
  10. partner_mobile = Phone(partner_field='partner_id')
  11. @api.multi
  12. def name_get(self):
  13. if self._context.get('callerid'):
  14. res = []
  15. for appl in self:
  16. if appl.partner_id:
  17. name = u'%s (%s)' % (appl.partner_id.name, appl.name)
  18. elif appl.partner_name:
  19. name = u'%s (%s)' % (appl.partner_name, appl.name)
  20. else:
  21. name = appl.name
  22. res.append((appl.id, name))
  23. return res
  24. else:
  25. return super(HrApplicant, self).name_get()