[REF] web: simplify calls to read_group in pivot model
The commit [3079415fb17232117b0d5059a23ae89232eaf5e8] allows the read_group groupby parameter not to be contained in the fields parameter. This makes possible the simplification made here. Similar changes could certainly be applied elsewhere.
This commit is contained in:
@@ -78,9 +78,6 @@ var PivotModel = AbstractModel.extend({
|
||||
var type = self.fields[measure].type;
|
||||
return (type === 'many2one') ? measure + ":count_distinct" : measure;
|
||||
});
|
||||
var fields = _.map(other_groupbys, function (field) {
|
||||
return field.split(':')[0];
|
||||
});
|
||||
|
||||
var groupbys = [];
|
||||
|
||||
@@ -94,7 +91,7 @@ var PivotModel = AbstractModel.extend({
|
||||
method: 'read_group',
|
||||
context: self.data.context,
|
||||
domain: header.domain.length ? header.domain : self.data.domain,
|
||||
fields: [].concat(field, fields, measures),
|
||||
fields: measures,
|
||||
groupBy: groupBy,
|
||||
lazy: false,
|
||||
});
|
||||
@@ -551,9 +548,6 @@ var PivotModel = AbstractModel.extend({
|
||||
return measure;
|
||||
}
|
||||
});
|
||||
var fields = _.map(rowGroupBys.concat(colGroupBys), function (field) {
|
||||
return field.split(':')[0];
|
||||
}).concat(measures);
|
||||
|
||||
for (var i = 0; i < rowGroupBys.length + 1; i++) {
|
||||
for (var j = 0; j < colGroupBys.length + 1; j++) {
|
||||
@@ -567,7 +561,7 @@ var PivotModel = AbstractModel.extend({
|
||||
method: 'read_group',
|
||||
context: self.data.context,
|
||||
domain: self.data.domain,
|
||||
fields: fields,
|
||||
fields: measures,
|
||||
groupBy: groupBy,
|
||||
lazy: false,
|
||||
});
|
||||
|
||||
@@ -1034,7 +1034,7 @@ QUnit.module('Views', {
|
||||
'</pivot>',
|
||||
});
|
||||
pivot.$('tbody .o_pivot_header_cell_closed').first().click();
|
||||
// click on date by day
|
||||
// click on date by month
|
||||
pivot.$('ul.o_pivot_field_menu > li[data-field="date"] a[data-interval="month"]').click();
|
||||
|
||||
assert.strictEqual(pivot.$('.o_pivot_cell_value').text(), '2211',
|
||||
@@ -1083,5 +1083,4 @@ QUnit.module('Views', {
|
||||
'should have loaded the proper data');
|
||||
pivot.destroy();
|
||||
});
|
||||
|
||||
});});
|
||||
|
||||
Reference in New Issue
Block a user