[IMP] web: Don't display aggregates in list views for columns with multi-currency records
Purpose: On a list view (Ex: the invoices list view), if a column is a currency column (Ex: total amount), it makes no sense to display the aggregate (Ex: sum) if the records contains several currencies. Spec: Don't display the aggregate of a column if a least two records are in different currencies.
This commit is contained in:
@@ -759,7 +759,16 @@ var ListView = View.extend({
|
||||
});
|
||||
|
||||
var aggregates = {};
|
||||
_(columns).each(function (column) {
|
||||
_.each(_.filter(columns, function (column) {
|
||||
if (column.currency_field === 'currency_id' && records && records[0].values['currency_id']) {
|
||||
var currency_ids = _.map(records, function(record) {return record.values['currency_id'][0]});
|
||||
if (_.every(currency_ids, function (currency_id){return currency_id === currency_ids[0]})) {
|
||||
return column;
|
||||
}
|
||||
} else {
|
||||
return column;
|
||||
}
|
||||
}), function (column) {
|
||||
var field = column.id;
|
||||
switch (column['function']) {
|
||||
case 'avg':
|
||||
|
||||
Reference in New Issue
Block a user