From 633780a00c33089a5bd6fbbd9388ed37d46d59b9 Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Tue, 11 Oct 2016 11:28:28 +0200 Subject: [PATCH] [FIX] web,crm: view_list respect group operator defined in the view. Remove useless avg defined on crm view. If you define avg='Average Values' in a view, now we see in the footer of list view the average. --- addons/crm/crm_lead_view.xml | 2 +- addons/web/static/src/js/view_list.js | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index 66e89457aeb..1980a9fe074 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -518,7 +518,7 @@ - + diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 9fe5426f2cc..a7686f8eebc 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -2182,7 +2182,6 @@ instance.web.list.Column = instance.web.Class.extend({ id: id, tag: tag }); - this.modifiers = attrs.modifiers ? JSON.parse(attrs.modifiers) : {}; delete attrs.modifiers; _.extend(this, attrs); @@ -2209,10 +2208,14 @@ instance.web.list.Column = instance.web.Class.extend({ if (this.type !== 'integer' && this.type !== 'float') { return {}; } - var aggregation_func = this['group_operator'] || 'sum'; - if (!(aggregation_func in this)) { + + var aggregation_func = (this.sum && 'sum') || (this.avg && 'avg') || + (this.max && 'max') || (this.min && 'min') || this.group_operator; + + if (!aggregation_func) { return {}; } + var C = function (fn, label) { this['function'] = fn; this.label = label;