Browse Source

Add widget="phone" in tree view, to have an easy-to-read phone number in tree view

pull/9/head
Alexis de Lattre 10 years ago
parent
commit
a395cd4cb6
  1. 10
      base_phone/res_partner_view.xml
  2. 11
      base_phone/static/src/js/phone_widget.js
  3. 22
      crm_phone/crm_view.xml
  4. 3
      event_phone/event_view.xml
  5. 22
      hr_phone/hr_view.xml
  6. 11
      hr_recruitment_phone/hr_recruitment_view.xml

10
base_phone/res_partner_view.xml

@ -45,6 +45,16 @@
</field> </field>
</record> </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> </data>
</openerp> </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'); 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> </field>
</record> </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"> <record id="crm_case_form_view_oppor" model="ir.ui.view">
<field name="name">crm_phone.case.view_opportuniy.form</field> <field name="name">crm_phone.case.view_opportuniy.form</field>
<field name="model">crm.lead</field> <field name="model">crm.lead</field>
@ -55,5 +66,16 @@
</field> </field>
</record> </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> </data>
</openerp> </openerp>

3
event_phone/event_view.xml

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

22
hr_phone/hr_view.xml

@ -21,5 +21,27 @@
</field> </field>
</record> </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> </data>
</openerp> </openerp>

11
hr_recruitment_phone/hr_recruitment_view.xml

@ -21,5 +21,16 @@
</field> </field>
</record> </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> </data>
</openerp> </openerp>
Loading…
Cancel
Save