From 74e52a9ce639c1114d5cdad75eaa6c742c0192bd Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Wed, 22 Jul 2015 15:31:36 +0200 Subject: [PATCH 01/29] [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 4a81e8aba13f3a306e51b0414d89c64d3ae03ba6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Wed, 22 Jul 2015 16:39:21 +0200 Subject: [PATCH 02/29] [FIX] web: no selection widget in search with many2one fields In previous releases, the search view ignored the selection widget when the field is a many2one. This behaviour is justifield by the fact that the selection widget just doesn't work, and the default search input actually does work. The search view was refactored extensively in late 2014, and this behaviour was lost. As a result, every many2one with a "selection" widget stopped working (for example, warehouse/products, a search for "you" does not give anything on "location" or on "warehouse"). This commits simply fix the issue by ignoring the selection widget in search views (with many2one fields). --- addons/web/static/src/js/search.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index 6010079db00..06f37dc0d0c 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -687,9 +687,16 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea current_group = []; } if (filter.item.tag === 'field') { - var attrs = filter.item.attrs, - field = self.fields_view_get.fields[attrs.name], - Obj = my.fields.get_any([attrs.widget, field.type]); + var attrs = filter.item.attrs; + var field = self.fields_view_get.fields[attrs.name]; + + // M2O combined with selection widget is pointless and broken in search views, + // but has been used in the past for unsupported hacks -> ignore it + if (field.type === "many2one" && attrs.widget === "selection") { + attrs.widget = undefined; + } + + var Obj = my.fields.get_any([attrs.widget, field.type]); if (Obj) { self.search_fields.push(new (Obj) (filter.item, field, self)); } From 99052611084eced10aec3fcdb9404a96e41e71ea Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Wed, 22 Jul 2015 14:52:39 +0100 Subject: [PATCH 03/29] [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 + + + + + +