summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorNicolas Lempereur <nle@odoo.com>2019-03-06 15:58:45 +0000
committerNicolas Lempereur <nle@odoo.com>2019-03-06 17:02:35 +0000
commitee5f1e277dd92cfcd1d980bc526989ed2b54a3b6 (patch)
tree75edbffc701c01d6dd3023384f45cfc2d341b23d /addons/web/static/src
parent7ef65579028dff4220f7f0ce8dd6c4707fb2dd0a (diff)
[FIX] web: pivot no result no remove groupbys
Since f8b38f64d dictionaries "groupbys" are the same object between the pivot model instance and the headers menu. But this causes an issue in 12.0 since when there is no results, the headers menu groupbys is truncated and now being the same object, the pivot model instance is also truncated. So succedding search that find results would possibly have lost the groupbys which is unexpected and breaks some 12.0 tests not expecting it. With this changeset, the groupbys are not truncated anymore. Without the change, the added test fails with: Column groupby not lost after reload after empty results expected: { "pivot_column_groupby": [ "customer" ], "pivot_measures": [ "__count" ], "pivot_row_groupby": [] } result: { "pivot_column_groupby": [], "pivot_measures": [ "__count" ], "pivot_row_groupby": [] } closes #31644 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/views/pivot/pivot_model.js15
1 files changed, 0 insertions, 15 deletions
diff --git a/addons/web/static/src/js/views/pivot/pivot_model.js b/addons/web/static/src/js/views/pivot/pivot_model.js
index 1e669824ec8..7c4ddff9d22 100644
--- a/addons/web/static/src/js/views/pivot/pivot_model.js
+++ b/addons/web/static/src/js/views/pivot/pivot_model.js
@@ -274,12 +274,10 @@ var PivotModel = AbstractModel.extend({
// if we don't have the key 'groupBy' in params. In that case,
// we want to have the full open state for the groupbys.
self._updateTree(old_row.root, self.data.main_row.root);
- self._updateMainGroupBys(old_row, self.data.main_row);
}
if (!('pivot_column_groupby' in (params.context || {}))) {
self._updateTree(old_col.root, self.data.main_col.root);
- self._updateMainGroupBys(old_col, self.data.main_col);
}
});
},
@@ -712,19 +710,6 @@ var PivotModel = AbstractModel.extend({
}
},
/**
- * Updates the groupBys that the main[row | col] holds
- *
- * @private
- * @param {Object} old: The main abstract header before reload
- * @param {Object} main: The main abstract header after reload
- *
- */
- _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);
- },
- /**
* @param {Object} old_tree
* @param {Object} new_tree
*/