Browse Source

Merge pull request #9 from akretion/8.0-tree-phone-widget

8.0 Adds widget="phone" in tree view
pull/10/head
Guewen Baconnier 10 years ago
parent
commit
f2efbde732
  1. 14
      asterisk_click2dial/scripts/set_name_agi.py
  2. 10
      base_phone/res_partner_view.xml
  3. 11
      base_phone/static/src/js/phone_widget.js
  4. 22
      crm_phone/crm_view.xml
  5. 3
      event_phone/event_view.xml
  6. 22
      hr_phone/hr_view.xml
  7. 11
      hr_recruitment_phone/hr_recruitment_view.xml

14
asterisk_click2dial/scripts/set_name_agi.py

@ -103,8 +103,9 @@ from optparse import OptionParser
# Name that will be displayed if there is no match
# and no geolocalisation
not_found_name = "Not in OpenERP"
# 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"
# Define command line options
options = [
@ -353,10 +354,11 @@ def main(options, arguments):
res = convert_to_ascii(res)
stdout_write('VERBOSE "Name = %s"\n' % res)
if options.outgoing:
stdout_write('SET VARIABLE connectedlinename "%s"\n' % res)
else:
stdout_write('SET CALLERID "%s"<%s>\n' % (res, phone_number))
if res:
if options.outgoing:
stdout_write('SET VARIABLE connectedlinename "%s"\n' % res)
else:
stdout_write('SET CALLERID "%s"<%s>\n' % (res, phone_number))
return True
if __name__ == '__main__':

10
base_phone/res_partner_view.xml

@ -45,6 +45,16 @@
</field>
</record>
<record id="view_partner_tree" model="ir.ui.view">
<field name="name">base_phone.phone.widget.partner.tree</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_tree"/>
<field name="arch" type="xml">
<field name="phone" position="attributes">
<attribute name="widget">phone</attribute>
</field>
</field>
</record>
</data>
</openerp>

11
base_phone/static/src/js/phone_widget.js

@ -102,4 +102,15 @@ openerp.base_phone = function (instance) {
instance.web.form.widgets.add('fax', 'instance.base_phone.FieldFax');
/* ability to add widget="phone" in TREE view */
var _super_list_char_format_ = instance.web.list.Char.prototype._format;
instance.web.list.Char.prototype._format = function(row_data, options) {
res = _super_list_char_format_.call(this, row_data, options);
var value = row_data[this.id].value;
if (value && this.widget === 'phone') {
return formatInternational('', value);
}
return res;
};
}

22
crm_phone/crm_view.xml

@ -24,6 +24,17 @@
</field>
</record>
<record id="crm_case_tree_view_leads" model="ir.ui.view">
<field name="name">crm_phone.crm_lead.tree</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.crm_case_tree_view_leads"/>
<field name="arch" type="xml">
<field name="phone" position="attributes">
<attribute name="widget">phone</attribute>
</field>
</field>
</record>
<record id="crm_case_form_view_oppor" model="ir.ui.view">
<field name="name">crm_phone.case.view_opportuniy.form</field>
<field name="model">crm.lead</field>
@ -55,5 +66,16 @@
</field>
</record>
<record id="crm_case_phone_tree_view" model="ir.ui.view">
<field name="name">crm_phone.crm_phonecall.tree</field>
<field name="model">crm.phonecall</field>
<field name="inherit_id" ref="crm.crm_case_phone_tree_view"/>
<field name="arch" type="xml">
<field name="partner_phone" position="attributes">
<attribute name="widget">phone</attribute>
</field>
</field>
</record>
</data>
</openerp>

3
event_phone/event_view.xml

@ -26,6 +26,9 @@
<xpath expr="//field[@name='registration_ids']/form//field[@name='phone']" position="attributes">
<attribute name="widget">phone</attribute>
</xpath>
<xpath expr="////field[@name='registration_ids']/tree/field[@name='phone']" position="attributes">
<attribute name="widget">phone</attribute>
</xpath>
</field>
</record>

22
hr_phone/hr_view.xml

@ -21,5 +21,27 @@
</field>
</record>
<record id="view_employee_tree" model="ir.ui.view">
<field name="name">hr_phone.hr_employee.tree</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_tree"/>
<field name="arch" type="xml">
<field name="work_phone" position="attributes">
<attribute name="widget">phone</attribute>
</field>
</field>
</record>
<record id="view_partner_tree2" model="ir.ui.view">
<field name="name">hr_phone.hr.employee.tree2</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_partner_tree2"/>
<field name="arch" type="xml">
<field name="work_phone" position="attributes">
<attribute name="widget">phone</attribute>
</field>
</field>
</record>
</data>
</openerp>

11
hr_recruitment_phone/hr_recruitment_view.xml

@ -21,5 +21,16 @@
</field>
</record>
<record id="crm_case_tree_view_job" model="ir.ui.view">
<field name="name">hr_recruitment_phone.hr_applicant.tree</field>
<field name="model">hr.applicant</field>
<field name="inherit_id" ref="hr_recruitment.crm_case_tree_view_job"/>
<field name="arch" type="xml">
<field name="partner_phone" position="attributes">
<attribute name="widget">phone</attribute>
</field>
</field>
</record>
</data>
</openerp>
Loading…
Cancel
Save