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.
 
 
 
 
 

38 lines
1.3 KiB

# -*- coding: utf-8 -*-
# Copyright 2012-2018 Akretion France
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, models
class HrApplicant(models.Model):
_name = 'hr.applicant'
_inherit = ['hr.applicant', 'phone.validation.mixin']
_phone_name_sequence = 50
_phone_name_fields = ['partner_phone', 'partner_mobile']
@api.onchange('partner_phone')
def partner_phone_change(self):
if self.partner_phone:
self.partner_phone = self.phone_format(self.partner_phone)
@api.onchange('partner_mobile')
def partner_mobile_change(self):
if self.partner_mobile:
self.partner_mobile = self.phone_format(self.partner_mobile)
def name_get(self):
if self._context.get('callerid'):
res = []
for appl in self:
if appl.partner_id:
name = u'%s (%s)' % (appl.partner_id.name, appl.name)
elif appl.partner_name:
name = u'%s (%s)' % (appl.partner_name, appl.name)
else:
name = appl.name
res.append((appl.id, name))
return res
else:
return super(HrApplicant, self).name_get()