From 74e52a9ce639c1114d5cdad75eaa6c742c0192bd Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Wed, 22 Jul 2015 15:31:36 +0200 Subject: [PATCH 01/22] [FIX] im_livechat: hide livechat button when printing related to opw-645011 --- addons/im_livechat/static/src/js/im_livechat.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/im_livechat/static/src/js/im_livechat.js b/addons/im_livechat/static/src/js/im_livechat.js index 2d665098bce..6b52090f0a9 100644 --- a/addons/im_livechat/static/src/js/im_livechat.js +++ b/addons/im_livechat/static/src/js/im_livechat.js @@ -123,7 +123,7 @@ }); im_livechat.ChatButton = openerp.Widget.extend({ - className: "openerp_style oe_chat_button", + className: "openerp_style oe_chat_button hidden-print", events: { "click": "click" }, From 99052611084eced10aec3fcdb9404a96e41e71ea Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Wed, 22 Jul 2015 14:52:39 +0100 Subject: [PATCH 02/22] [FIX] crm: permissions on computed field Accessing the phonecall and the lead do not require the same permissions so should not be computed in the same method. The effect of the multi was already lost as the phonecall_count was already computed in another loop. Add the phonecall_count button in a second view to make the computation only if the user has the requried access rights. Fixes #2458 --- addons/crm/res_partner.py | 8 ++++++-- addons/crm/res_partner_view.xml | 15 +++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/addons/crm/res_partner.py b/addons/crm/res_partner.py index 25020fe16b9..c920379a3f7 100644 --- a/addons/crm/res_partner.py +++ b/addons/crm/res_partner.py @@ -41,8 +41,12 @@ class res_partner(osv.osv): } except: pass + return res + + def _phonecall_count(self, cr, uid, ids, field_name, arg, context=None): + res = {} for partner in self.browse(cr, uid, ids, context): - res[partner.id]['phonecall_count'] = len(partner.phonecall_ids) + res[partner.id] = len(partner.phonecall_ids) return res _columns = { @@ -55,7 +59,7 @@ class res_partner(osv.osv): 'Phonecalls'), 'opportunity_count': fields.function(_opportunity_meeting_phonecall_count, string="Opportunity", type='integer', multi='opp_meet'), 'meeting_count': fields.function(_opportunity_meeting_phonecall_count, string="# Meetings", type='integer', multi='opp_meet'), - 'phonecall_count': fields.function(_opportunity_meeting_phonecall_count, string="Phonecalls", type="integer", multi='opp_meet'), + 'phonecall_count': fields.function(_phonecall_count, string="Phonecalls", type="integer"), } def redirect_partner_form(self, cr, uid, partner_id, context=None): diff --git a/addons/crm/res_partner_view.xml b/addons/crm/res_partner_view.xml index 3b6c4dcaa87..006eb4602ad 100644 --- a/addons/crm/res_partner_view.xml +++ b/addons/crm/res_partner_view.xml @@ -103,6 +103,21 @@ context="{'partner_id': active_id}"> + + + + + + + + view.res.partner.form.crm.inherited.calls + res.partner + + + + + +