Browse Source

Restore the object crm.phonecall that was dropped in v9 community

Proper name_get for callerid for applicants
Small bugfixes/enhancements
pull/88/head
Alexis de Lattre 8 years ago
parent
commit
81f01f52a1
  1. 12
      asterisk_click2dial/res_users_view.xml
  2. 6
      asterisk_click2dial/scripts/set_name_agi.py
  3. 18
      base_phone/static/src/js/phone_widget.js
  4. 1
      base_phone/wizard/number_not_found_view.xml
  5. 9
      crm_phone/__openerp__.py
  6. 152
      crm_phone/crm_phone.py
  7. 59
      crm_phone/demo/crm_phonecall.xml
  8. 3
      crm_phone/security/ir.model.access.csv
  9. 28
      crm_phone/security/phonecall_security.xml
  10. 16
      crm_phone/view/crm_lead.xml
  11. 160
      crm_phone/view/crm_phonecall.xml
  12. 30
      crm_phone/view/res_partner.xml
  13. 0
      crm_phone/view/res_users.xml
  14. 19
      crm_phone/wizard/create_crm_phonecall.py
  15. 6
      crm_phone/wizard/number_not_found_view.xml
  16. 1
      hr_phone/security/ir.model.access.csv
  17. 16
      hr_recruitment_phone/hr_recruitment_phone.py

12
asterisk_click2dial/res_users_view.xml

@ -35,5 +35,17 @@
</field>
</record>
<record id="view_users_form_simple_modif" model="ir.ui.view">
<field name="name">asterisk_click2dial.users.preferences.form</field>
<field name="model">res.users</field>
<field name="inherit_id" ref="base_phone.view_users_form_simple_modif"/>
<field name="arch" type="xml">
<group name="phone" position="attributes">
<attribute name="invisible">0</attribute>
</group>
</field>
</record>
</data>
</odoo>

6
asterisk_click2dial/scripts/set_name_agi.py

@ -1,6 +1,6 @@
#! /usr/bin/python
# -*- encoding: utf-8 -*-
# Copyright (C) 2010-2015 Alexis de Lattre <alexis.delattre@akretion.com>
# -*- coding: utf-8 -*-
# © 2010-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@ -104,7 +104,7 @@ __version__ = "0.6"
# Name that will be displayed if there is no match
# and no geolocalisation. Set it to False if you don't want
# to have a 'not_found_name' when nothing is found
not_found_name = "Not in Odoo"
not_found_name = False
# Define command line options
options = [

18
base_phone/static/src/js/phone_widget.js

@ -7,6 +7,7 @@ odoo.define('base_phone.phone_widget', function (require) {
var core = require('web.core');
var formwidgets = require('web.form_widgets');
var web_client = require('web.web_client');
var _t = core._t;
@ -76,7 +77,7 @@ var FieldPhone = formwidgets.FieldChar.extend({
target: 'new',
context: context,
};
formwidgets.client.action_manager.do_action(action);
web_client.action_manager.do_action(action);
}
}
});
@ -133,7 +134,7 @@ if(!core.form_widget_registry.get('phone')){
}
/*
var Column = require('web.list_view.js');
var Column = require('web.ListView');
var ColumnPhone = Column.extend({
// ability to add widget="phone" in TREE view
@ -141,18 +142,21 @@ var ColumnPhone = Column.extend({
console.log('row_data=' + row_data);
console.log('options=');
console.log(options);
var value = row_data[this.id].value;
if (value && this.widget === 'phone') {
var value = row_data[this.id].value;
if (value) {
readable_space = formatInternational('', value);
readable_no_break_space = readable_space.replace(/\s/g, ' ');
console('special return');
return readable_no_break_space;
}
}
console.log('return normal');
return this._super(row_data, options);
}
});
if (!core.list_widget_registry.get('phone')) {
core.list_widget_registry.add('field.phone', ColumnPhone);
// a mon avis, il y a une mauvaise compréhension : fields.phone signifiera fields.Phone dans le python
} */
core.list_widget_registry.add('field.phone', ColumnPhone);
*/
});

1
base_phone/wizard/number_not_found_view.xml

@ -14,7 +14,6 @@
<field name="arch" type="xml">
<form string="Number Not Found">
<div class="oe_title">
<label string="Number not found:" for="calling_number"/>
<h1>
<field name="calling_number" />
</h1>

9
crm_phone/__openerp__.py

@ -24,13 +24,18 @@ for any help or question about this module.
'author': "Akretion,Odoo Community Association (OCA)",
'website': 'http://www.akretion.com/',
'depends': ['base_phone', 'crm'],
'conflicts': ['crm_voip'],
'data': [
'security/phonecall_security.xml',
'security/ir.model.access.csv',
'crm_view.xml',
'res_users_view.xml',
'view/crm_phonecall.xml',
'view/crm_lead.xml',
'view/res_partner.xml',
'view/res_users.xml',
'wizard/number_not_found_view.xml',
'wizard/create_crm_phonecall_view.xml',
],
'demo': ['demo/crm_phonecall.xml'],
'test': ['test/phonenum.yml'],
'installable': True,
'auto_install': True,

152
crm_phone/crm_phone.py

@ -23,14 +23,11 @@ class CrmLead(models.Model):
vals_reformated = self._reformat_phonenumbers_write(vals)
return super(CrmLead, self).write(vals_reformated)
def name_get(self, cr, uid, ids, context=None):
if context is None:
context = {}
if context.get('callerid'):
@api.multi
def name_get(self):
if self._context.get('callerid'):
res = []
if isinstance(ids, (int, long)):
ids = [ids]
for lead in self.browse(cr, uid, ids, context=context):
for lead in self:
if lead.partner_name and lead.contact_name:
name = u'%s (%s)' % (lead.contact_name, lead.partner_name)
elif lead.partner_name:
@ -42,8 +39,145 @@ class CrmLead(models.Model):
res.append((lead.id, name))
return res
else:
return super(CrmLead, self).name_get(
cr, uid, ids, context=context)
return super(CrmLead, self).name_get()
phonecall_ids = fields.One2many(
'crm.phonecall', 'opportunity_id', string='Phone Calls')
phonecall_count = fields.Integer(
compute='_count_phonecalls', string='Number of Phonecalls',
readonly=True)
@api.multi
@api.depends('phonecall_ids')
def _count_phonecalls(self):
cpo = self.env['crm.phonecall']
for lead in self:
try:
lead.phonecall_count = cpo.search_count(
[('opportunity_id', '=', lead.id)])
except:
lead.phonecall_count = 0
class CrmPhonecall(models.Model):
_name = 'crm.phonecall'
_inherit = ['phone.common', 'mail.thread']
_order = "id desc"
_phone_fields = ['partner_phone', 'partner_mobile']
_country_field = None
_partner_field = 'partner_id'
# Restore the object that existed in v8
# and doesn't exist in v9 community any more
name = fields.Char(
string='Call Summary', required=True, track_visibility='onchange')
date = fields.Datetime(
string='Date', track_visibility='onchange', copy=False,
default=lambda self: fields.Datetime.now())
description = fields.Text(string='Description', copy=False)
company_id = fields.Many2one(
'res.company', string='Company',
default=lambda self: self.env['res.company']._company_default_get(
'crm.phonecall'))
user_id = fields.Many2one(
'res.users', string='Responsible', track_visibility='onchange',
default=lambda self: self.env.user)
team_id = fields.Many2one(
'crm.team', string='Sales Team', track_visibility='onchange',
default=lambda self: self.env['crm.team']._get_default_team_id())
partner_id = fields.Many2one(
'res.partner', string='Contact', ondelete='cascade')
partner_phone = fields.Char(string='Phone')
partner_mobile = fields.Char(string='Mobile')
priority = fields.Selection([
('0', 'Low'),
('1', 'Normal'),
('2', 'High')
], string='Priority', track_visibility='onchange', default='1')
opportunity_id = fields.Many2one(
'crm.lead', string='Lead/Opportunity',
ondelete='cascade', track_visibility='onchange')
state = fields.Selection([
('open', 'To Do'),
('done', 'Held'),
('cancel', 'Cancelled'),
], string='Status', default='open', copy=False, required=True,
track_visibility='onchange',
help='The status is set to Confirmed, when a case is created.\n'
'When the call is over, the status is set to Held.\n'
'If the call is not applicable anymore, the status can be set to '
'Cancelled.')
direction = fields.Selection([
('inbound', 'Inbound'),
('outbound', 'Outbound'),
], string='Type', required=True, default='outbound')
@api.model
def create(self, vals):
vals_reformated = self._reformat_phonenumbers_create(vals)
return super(CrmPhonecall, self).create(vals_reformated)
@api.multi
def write(self, vals):
vals_reformated = self._reformat_phonenumbers_write(vals)
return super(CrmPhonecall, self).write(vals_reformated)
@api.onchange('partner_id')
def onchange_partner_id(self):
if self.partner_id:
self.partner_phone = self.partner_id.phone
self.partner_mobile = self.partner_id.mobile
@api.onchange('opportunity_id')
def onchange_opportunity_id(self):
if self.opportunity_id:
self.partner_phone = self.opportunity_id.phone
self.partner_mobile = self.opportunity_id.mobile
self.team_id = self.opportunity_id.team_id.id
self.partner_id = self.opportunity_id.partner_id.id
@api.multi
def schedule_another_call(self):
self.ensure_one()
cur_call = self[0]
ctx = self._context.copy()
ctx.update({
'default_date': False,
'default_partner_id': cur_call.partner_id.id,
'default_opportunity_id': cur_call.opportunity_id.id,
'default_direction': 'outbound',
'default_partner_phone': cur_call.partner_phone,
'default_partner_mobile': cur_call.partner_mobile,
})
action = {
'name': _('Phone Call'),
'type': 'ir.actions.act_window',
'res_model': 'crm.phonecall',
'view_mode': 'form,tree,calendar',
'context': ctx,
}
return action
class ResPartner(models.Model):
_inherit = 'res.partner'
phonecall_ids = fields.One2many(
'crm.phonecall', 'partner_id', string='Phone Calls')
phonecall_count = fields.Integer(
compute='_count_phonecalls', string='Number of Phonecalls',
readonly=True)
@api.multi
@api.depends('phonecall_ids')
def _count_phonecalls(self):
cpo = self.env['crm.phonecall']
for partner in self:
try:
partner.phonecall_count = cpo.search_count(
[('partner_id', 'child_of', partner.id)])
except:
partner.phonecall_count = 0
class ResUsers(models.Model):

59
crm_phone/demo/crm_phonecall.xml

@ -0,0 +1,59 @@
<?xml version="1.0"?>
<odoo>
<data noupdate="1">
<record id="crm_phonecall1" model="crm.phonecall">
<field name="date" eval="time.strftime('%Y-%m-01 11:42:12')"/>
<field name="partner_id" ref="base.res_partner_1"/>
<field name="user_id" ref="base.user_root"/>
<field name="name">Presentation of new product line</field>
<field name="state">done</field>
<field name="partner_phone">+33442127812</field>
<field name="direction">outbound</field>
</record>
<record id="crm_phonecall2" model="crm.phonecall">
<field name="date" eval="time.strftime('%Y-%m-28 09:12:42')"/>
<field name="partner_id" ref="base.res_partner_2"/>
<field name="user_id" ref="base.user_demo"/>
<field name="name">Close the deal</field>
<field name="state">open</field>
<field name="partner_phone">+33543137913</field>
<field name="direction">outbound</field>
</record>
<record id="crm_phonecall3" model="crm.phonecall">
<field name="date" eval="time.strftime('%Y-%m-27 09:45:42')"/>
<field name="partner_id" ref="base.res_partner_address_3"/>
<field name="user_id" ref="base.user_demo"/>
<field name="name">Lobby about our offer</field>
<field name="state">open</field>
<field name="partner_phone">+33543137914</field>
<field name="direction">outbound</field>
</record>
<record id="crm_phonecall4" model="crm.phonecall">
<field name="date" eval="time.strftime('%Y-%m-26 09:45:42')"/>
<field name="opportunity_id" ref="crm.crm_case_2"/>
<field name="user_id" ref="base.user_root"/>
<field name="name">Remote Demo of the software</field>
<field name="state">open</field>
<field name="partner_phone">+33789320421</field>
<field name="direction">outbound</field>
</record>
<record id="crm_phonecall5" model="crm.phonecall">
<field name="date" eval="time.strftime('%Y-%m-02 09:45:42')"/>
<field name="opportunity_id" ref="crm.crm_case_1"/>
<field name="user_id" ref="base.user_demo"/>
<field name="name">Asked training program</field>
<field name="state">done</field>
<field name="partner_phone">+33389320442</field>
<field name="direction">inbound</field>
</record>
</data>
</odoo>

3
crm_phone/security/ir.model.access.csv

@ -1,2 +1,5 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
callerid_crm_lead_read,Read access on crm.lead,crm.model_crm_lead,base_phone.group_callerid,1,0,0,0
access_crm_phonecall_partner_manager,Full access on crm.phonecall to Contact mgr,model_crm_phonecall,base.group_partner_manager,1,1,1,1
access_crm_phonecall_sale_manager,Full access on crm.phonecall to Sale mgr,model_crm_phonecall,base.group_sale_manager,1,1,1,1
access_crm_phonecall_sale_user,Read/Write/Create access on crm.phonecall to Sale users,model_crm_phonecall,base.group_sale_salesman,1,1,1,0

28
crm_phone/security/phonecall_security.xml

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<record id="my_crm_phonecall_rule" model="ir.rule">
<field name="name">Personal Phone Calls</field>
<field name="model_id" ref="model_crm_phonecall"/>
<field name="groups" eval="[(4, ref('base.group_sale_salesman'))]"/>
<field name="domain_force">['|', ('user_id', '=', False), ('user_id', '=', user.id)]</field>
</record>
<record id="all_crm_phonecall_rule" model="ir.rule">
<field name="name">All Phone Calls</field>
<field name="model_id" ref="model_crm_phonecall"/>
<field name="groups" eval="[(4, ref('base.group_sale_salesman_all_leads'))]"/>
<field name="domain_force">[(1, '=', 1)]</field>
</record>
<record id="multi_company_crm_phonecall_rule" model="ir.rule">
<field name="name">Multi-company Phone Calls</field>
<field name="model_id" ref="model_crm_phonecall"/>
<field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field>
</record>
</data>
</odoo>

16
crm_phone/crm_view.xml → crm_phone/view/crm_lead.xml

@ -19,6 +19,14 @@
<field name="fax" position="attributes">
<attribute name="widget">fax</attribute>
</field>
<div name="button_box" position="inside">
<button class="oe_inline oe_stat_button" type="action"
name="%(crm_phone.crm_phonecall_action)d"
icon="fa-phone"
context="{'search_default_opportunity_id': active_id}">
<field string="Calls" name="phonecall_count" widget="statinfo"/>
</button>
</div>
</field>
</record>
@ -44,6 +52,14 @@
<field name="fax" position="attributes">
<attribute name="widget">fax</attribute>
</field>
<div name="button_box" position="inside">
<button class="oe_inline oe_stat_button" type="action"
name="%(crm_phone.crm_phonecall_action)d"
icon="fa-phone"
context="{'search_default_opportunity_id': active_id}">
<field string="Calls" name="phonecall_count" widget="statinfo"/>
</button>
</div>
</field>
</record>

160
crm_phone/view/crm_phonecall.xml

@ -0,0 +1,160 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
© 2014-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<data>
<record id="crm_phonecall_form" model="ir.ui.view">
<field name="name">crm.phonecall.form</field>
<field name="model">crm.phonecall</field>
<field name="arch" type="xml">
<form string="Phone Call">
<header>
<field name="state" widget="statusbar" clickable="True"/>
</header>
<sheet>
<div class="oe_button_box" name="button_box">
<button class="oe_stat_button" type="object"
name="schedule_another_call" icon="fa-phone"
string="Schedule Another Call"/>
</div>
<div class="oe_title">
<div class="oe_edit_only">
<label for="name"/>
</div>
<h1><field name="name"/></h1>
</div>
<group name="main">
<group name="left">
<field name="date"/>
<field name="user_id"/>
<field name="partner_id"/>
<field name="partner_phone" widget="phone"/>
<field name="partner_mobile" widget="phone"/>
<field name="opportunity_id"/>
</group>
<group name="right">
<field name="direction"/>
<field name="team_id" groups="base.group_multi_salesteams"/>
<field name="company_id" groups="base.group_multi_company"/>
<field name="priority" widget="priority"/>
</group>
</group>
<group name="description" string="Description">
<field name="description" nolabel="1"
placeholder="Summary of the phone call..."/>
</group>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"/>
<field name="message_ids" widget="mail_thread"/>
</div>
</form>
</field>
</record>
<record id="crm_phonecall_tree" model="ir.ui.view">
<field name="name">crm.phonecall.tree</field>
<field name="model">crm.phonecall</field>
<field name="arch" type="xml">
<tree string="Phone Calls" editable="top">
<field name="date"/>
<field name="name"/>
<field name="partner_id"/>
<field name="opportunity_id"/>
<field name="user_id"/>
<field name="team_id" groups="base.group_multi_salesteams"/>
<field name="direction"/>
<field name="state"/>
<button name="schedule_another_call" type="object"
string="Schedule Another Call" icon="terp-call-start"/>
</tree>
</field>
</record>
<record id="crm_phonecall_calendar" model="ir.ui.view">
<field name="name">crm.phonecall.calendar</field>
<field name="model">crm.phonecall</field>
<field name="arch" type="xml">
<calendar string="Phone Calls" date_start="date" color="user_id">
<field name="name"/>
<field name="partner_id"/>
</calendar>
</field>
</record>
<record id="crm_phonecall_search" model="ir.ui.view">
<field name="name">crm.phonecall.search</field>
<field name="model">crm.phonecall</field>
<field name="arch" type="xml">
<search string="Search Phone Calls">
<field name="name" string="Phonecalls"/>
<field name="date"/>
<field name="user_id"/>
<field name="partner_id" operator="child_of"/>
<field name="opportunity_id"/>
<field name="team_id" groups="base.group_multi_salesteams"/>
<filter string="My Phonecalls" domain="[('user_id', '=', uid)]"/>
<filter string="My Team" domain="[('section_id.user_id', '=', uid)]"/>
<filter string="Unassigned" domain="[('user_id', '=', False)]"/>
<separator/>
<filter string="To Do" name="open" domain="[('state', '=', 'open')]"/>
<filter string="Held" name="done" domain="[('state', '=', 'done')]"/>
<separator/>
<filter string="Inbound" domain="[('direction', '=', 'inbound')]"/>
<filter string="Outbound" domain="[('direction', '=', 'outbound')]"/>
<group string="Group By" name="groupby">
<filter name="partner_groupby" string="Partner"
context="{'group_by': 'partner_id'}"/>
<filter name="user_groupby" string="Responsible"
context="{'group_by': 'user_id'}"/>
<filter name="team_groupby" string="Team"
context="{'group_by': 'team_id'}"
groups="base.group_multi_salesteams"/>
<filter name="date_groupby" string="Month"
context="{'group_by': 'date'}"/>
<filter name="state_groupby" string="State"
context="{'group_by': 'state'}"/>
<filter name="direction" string="Direction"
context="{'group_by': 'direction'}"/>
</group>
</search>
</field>
</record>
<menuitem id="crm_phonecall_menu" name="Phone Calls"
parent="base.menu_base_partner" sequence="7" groups="base.group_sale_salesman"/>
<record id="crm_phonecall_action" model="ir.actions.act_window">
<field name="name">Phone Calls</field>
<field name="res_model">crm.phonecall</field>
<field name="view_mode">tree,calendar,form</field>
</record>
<record id="crm_phonecall_action_done" model="ir.actions.act_window">
<field name="name">Logged Calls</field>
<field name="res_model">crm.phonecall</field>
<field name="view_mode">tree,calendar,form</field>
<field name="context">{'search_default_done': 1, 'default_state': 'done'}</field>
</record>
<menuitem id="crm_phonecall_menu_done" action="crm_phonecall_action_done"
parent="crm_phonecall_menu" sequence="10"/>
<record id="crm_phonecall_action_open" model="ir.actions.act_window">
<field name="name">Scheduled Calls</field>
<field name="res_model">crm.phonecall</field>
<field name="view_mode">tree,calendar,form</field>
<field name="context">{'search_default_open': 1, 'default_state': 'open'}</field>
</record>
<menuitem id="crm_phonecall_menu_open" action="crm_phonecall_action_open"
parent="crm_phonecall_menu" sequence="20"/>
</data>
</odoo>

30
crm_phone/view/res_partner.xml

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
© 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<data>
<record id="view_partner_form" model="ir.ui.view">
<field name="name">phonecall.res.partner.form</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="groups_id" eval="[(4, ref('base.group_sale_salesman')), (4, ref('base.group_partner_manager'))]"/>
<field name="arch" type="xml">
<div name="button_box" position="inside">
<button class="oe_inline oe_stat_button" type="action"
name="%(crm_phone.crm_phonecall_action)d"
icon="fa-phone"
context="{'search_default_partner_id': active_id}">
<field string="Calls" name="phonecall_count" widget="statinfo"/>
</button>
</div>
</field>
</record>
</data>
</odoo>

0
crm_phone/res_users_view.xml → crm_phone/view/res_users.xml

19
crm_phone/wizard/create_crm_phonecall.py

@ -6,33 +6,28 @@ from openerp import models, api, _
import phonenumbers
# TODO : crm.phonecall : doesn't exist any more... what is the replacement ?
class WizardCreateCrmPhonecall(models.TransientModel):
_name = "wizard.create.crm.phonecall"
@api.multi
def button_create_outgoing_phonecall(self):
self.ensure_one()
return self._create_open_crm_phonecall(crm_categ='Outbound')
return self._create_open_crm_phonecall('outbound')
@api.model
def _create_open_crm_phonecall(self, crm_categ):
categ = self.with_context(lang='en_US').env['crm.case.categ'].search(
[('name', '=', crm_categ)])
case_section = self.env['crm.case.section'].search(
def _create_open_crm_phonecall(self, direction='outbound'):
teams = self.env['crm.team'].search(
[('member_ids', 'in', self._uid)])
action_ctx = self.env.context.copy()
action_ctx.update({
'default_categ_id': categ and categ[0].id or False,
'default_section_id':
case_section and case_section[0].id or False,
'default_direction': direction,
'default_team_id': teams and teams[0].id or False,
})
domain = False
if self.env.context.get('click2dial_model') == 'res.partner':
partner_id = self.env.context.get('click2dial_id')
action_ctx['default_partner_id'] = partner_id
domain = [('partner_id', '=', partner_id)]
domain = [('partner_id', 'child_of', partner_id)]
elif self.env.context.get('click2dial_model') == 'crm.lead':
lead_id = self.env.context.get('click2dial_id')
action_ctx['default_opportunity_id'] = lead_id
@ -50,7 +45,7 @@ class WizardCreateCrmPhonecall(models.TransientModel):
'type': 'ir.actions.act_window',
'res_model': 'crm.phonecall',
'domain': domain,
'view_mode': 'form,tree',
'view_mode': 'form,tree,calendar',
'nodestroy': False, # close the pop-up wizard after action
'target': 'current',
'context': action_ctx,

6
crm_phone/wizard/number_not_found_view.xml

@ -16,14 +16,16 @@
<group name="lead" string="Create or Update a Lead"
colspan="1">
<button name="create_lead" colspan="2"
string="Create Lead with this Number" type="object"/>
string="Create Lead with this Number" type="object"
class="oe_highlight"/>
<field name="to_update_lead_id"/>
<field name="current_lead_phone" widget="phone"
options="{'dial_button_invisible': True}"/>
<field name="current_lead_mobile" widget="phone"
options="{'dial_button_invisible': True}"/>
<button name="update_lead" colspan="2"
string="Update Lead with this Number" type="object"/>
string="Update Lead with this Number" type="object"
class="oe_highlight"/>
</group>
</group>
</field>

1
hr_phone/security/ir.model.access.csv

@ -1,2 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
callerid_hr_employee_read,Read access on hr.employee,hr.model_hr_employee,base_phone.group_callerid,1,0,0,0
callerid_resource_resource_read,Read access on resource.resource,resource.model_resource_resource,base_phone.group_callerid,1,0,0,0

16
hr_recruitment_phone/hr_recruitment_phone.py

@ -22,3 +22,19 @@ class HrApplicant(models.Model):
def write(self, vals):
vals_reformated = self._reformat_phonenumbers_write(vals)
return super(HrApplicant, self).write(vals_reformated)
@api.multi
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()
Loading…
Cancel
Save