From a395cd4cb6a4fcee042293506abd5edcc31cef68 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Wed, 17 Dec 2014 00:23:58 +0100 Subject: [PATCH] Add widget="phone" in tree view, to have an easy-to-read phone number in tree view --- base_phone/res_partner_view.xml | 10 +++++++++ base_phone/static/src/js/phone_widget.js | 11 ++++++++++ crm_phone/crm_view.xml | 22 ++++++++++++++++++++ event_phone/event_view.xml | 3 +++ hr_phone/hr_view.xml | 22 ++++++++++++++++++++ hr_recruitment_phone/hr_recruitment_view.xml | 11 ++++++++++ 6 files changed, 79 insertions(+) diff --git a/base_phone/res_partner_view.xml b/base_phone/res_partner_view.xml index f0a66f6..fdc1996 100644 --- a/base_phone/res_partner_view.xml +++ b/base_phone/res_partner_view.xml @@ -45,6 +45,16 @@ + + base_phone.phone.widget.partner.tree + res.partner + + + + phone + + + diff --git a/base_phone/static/src/js/phone_widget.js b/base_phone/static/src/js/phone_widget.js index 839fe40..4f18554 100644 --- a/base_phone/static/src/js/phone_widget.js +++ b/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; + }; + } diff --git a/crm_phone/crm_view.xml b/crm_phone/crm_view.xml index c3e8696..e4846e4 100644 --- a/crm_phone/crm_view.xml +++ b/crm_phone/crm_view.xml @@ -24,6 +24,17 @@ + + crm_phone.crm_lead.tree + crm.lead + + + + phone + + + + crm_phone.case.view_opportuniy.form crm.lead @@ -55,5 +66,16 @@ + + crm_phone.crm_phonecall.tree + crm.phonecall + + + + phone + + + + diff --git a/event_phone/event_view.xml b/event_phone/event_view.xml index ecf43b0..00fa86c 100644 --- a/event_phone/event_view.xml +++ b/event_phone/event_view.xml @@ -26,6 +26,9 @@ phone + + phone + diff --git a/hr_phone/hr_view.xml b/hr_phone/hr_view.xml index 3f7c7a7..b1bed5a 100644 --- a/hr_phone/hr_view.xml +++ b/hr_phone/hr_view.xml @@ -21,5 +21,27 @@ + + hr_phone.hr_employee.tree + hr.employee + + + + phone + + + + + + hr_phone.hr.employee.tree2 + hr.employee + + + + phone + + + + diff --git a/hr_recruitment_phone/hr_recruitment_view.xml b/hr_recruitment_phone/hr_recruitment_view.xml index e8a47b3..16e3817 100644 --- a/hr_recruitment_phone/hr_recruitment_view.xml +++ b/hr_recruitment_phone/hr_recruitment_view.xml @@ -21,5 +21,16 @@ + + hr_recruitment_phone.hr_applicant.tree + hr.applicant + + + + phone + + + +