[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.
This commit is contained in:
Jeremy Kersten 2016-10-11 11:28:28 +02:00
parent 4ca06e0255
commit 633780a00c
2 changed files with 7 additions and 4 deletions

View File

@ -518,7 +518,7 @@
<field name="source_id" invisible="1"/>
<field name="stage_id"/>
<field name="planned_revenue" sum="Expected Revenues"/>
<field name="probability" avg="Avg. of Probability"/>
<field name="probability" />
<field name="section_id" groups="base.group_multi_salesteams"/>
<field name="user_id"/>
<field name="referred" invisible="1"/>

View File

@ -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;