[IMP] mandate that @group_operator and listwise aggregation functions be coherent on a listview field, so we can aggregate groups correctly
bzr revid: xmo@openerp.com-20110607144215-g6beueaoo3tu350r
This commit is contained in:
parent
dc47f5a0c3
commit
dd4a3b8047
|
@ -203,15 +203,20 @@ openerp.base.ListView = openerp.base.View.extend( /** @lends openerp.base.ListVi
|
|||
|
||||
this.aggregate_columns = _(this.visible_columns)
|
||||
.map(function (column) {
|
||||
if (!(column['sum'] || column['avg'])) {
|
||||
if (column.type !== 'integer' && column.type !== 'float') {
|
||||
return {};
|
||||
}
|
||||
var func = column['sum'] ? 'sum' : 'avg';
|
||||
var aggregation_func = column['group_operator'] || 'sum';
|
||||
|
||||
if (!column[aggregation_func]) {
|
||||
return {};
|
||||
}
|
||||
|
||||
return {
|
||||
field: column.id,
|
||||
type: column.type,
|
||||
'function': func,
|
||||
label: column[func]
|
||||
'function': aggregation_func,
|
||||
label: column[aggregation_func]
|
||||
};
|
||||
});
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue