[REV] web: revert f8b38f64 "keep col group by on 2nd reload"

It broke other pivot tests.

closes odoo/odoo#31630

Signed-off-by: Christophe Simonis <chs@odoo.com>
This commit is contained in:
Christophe Simonis
2019-03-06 12:28:02 +00:00
parent ffc6df3c99
commit c6e7adfb95
2 changed files with 6 additions and 7 deletions
@@ -986,8 +986,7 @@ var PivotModel = AbstractModel.extend({
});
var index = 0;
var rowGroupBys = !_.isEmpty(this.data.groupedBy) ? this.data.groupedBy : this.initialRowGroupBys.slice();
this.data.groupedBy = rowGroupBys;
var rowGroupBys = !_.isEmpty(this.data.groupedBy) ? this.data.groupedBy : this.initialRowGroupBys;
var colGroupBys = this.data.colGroupBys;
var dataPoint, row, col, attrs, cell_value;
var main_row_header, main_col_header;
@@ -1129,8 +1128,8 @@ var PivotModel = AbstractModel.extend({
*/
_updateMainGroupBys: function (old, main) {
var new_groupby_length = this._getHeaderDepth(main.root) - 1;
main.root.groupbys = old.root.groupbys;
main.root.groupbys.splice(new_groupby_length);
var new_groupby_list = old.root.groupbys.slice(0, new_groupby_length);
main.root.groupbys = new_groupby_list;
},
/**
* @param {Object} old_tree
+3 -3
View File
@@ -1076,7 +1076,7 @@ QUnit.module('Views', {
pivot.destroy();
});
QUnit.test('Reload, group by columns, reload', function (assert) {
QUnit.skip('Reload, group by columns, reload', function (assert) {
assert.expect(2);
var pivot = createView({
@@ -1088,7 +1088,7 @@ QUnit.module('Views', {
// Set a column groupby
pivot.$('thead .o_pivot_header_cell_closed').click();
pivot.$('.o_field_selection li[data-field=customer] a').click();
pivot.$('.o_field_selection .dropdown-item[data-field=customer]').click();
// Set a domain
pivot.update({domain: [['product_id', '=', 41]]});
@@ -1103,7 +1103,7 @@ QUnit.module('Views', {
// Set a column groupby
pivot.$('thead .o_pivot_header_cell_closed').click();
pivot.$('.o_field_selection li[data-field=product_id] a').click();
pivot.$('.o_field_selection .dropdown-item[data-field=product_id]').click();
// Set a domain
pivot.update({domain: [['product_id', '=', 37]]});