From df02dc37fd2febd3fc899792ee25c80c0149d255 Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Fri, 13 Apr 2018 10:49:35 +0200 Subject: [FIX] web: pivot: correctly save and restore groupbys on rows and cols On a pivot view expand a field in column another one in row Then put a domain in the search view Save the whole thing (ir.filter) as favorite Before this commit, the ir.filter was not saved the right way when a domain was present (Let alone its restoration) This was because of - the internal default groupbys of the pivot model was not updated, and what we got in the params was overwritten by what existed before - a slight typo in the code made the row updated with the col values OPW 1835865 OPW 1829925 closes #24215 --- addons/web/static/src/js/views/pivot/pivot_model.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'addons/web/static/src') 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 1c76c41ab71..6eddd44ffe7 100644 --- a/addons/web/static/src/js/views/pivot/pivot_model.js +++ b/addons/web/static/src/js/views/pivot/pivot_model.js @@ -250,6 +250,7 @@ var PivotModel = AbstractModel.extend({ this.data.colGroupBys = params.context.pivot_column_groupby || this.data.colGroupBys; this.data.groupedBy = params.context.pivot_row_groupby || this.data.groupedBy; this.data.measures = this._processMeasures(params.context.pivot_measures) || this.data.measures; + this.defaultGroupedBy = this.data.groupedBy.length ? this.data.groupedBy : this.defaultGroupedBy; } if ('domain' in params) { this.data.domain = params.domain; @@ -278,7 +279,7 @@ var PivotModel = AbstractModel.extend({ self._updateTree(old_col_root, self.data.main_col.root); new_groupby_length = self._getHeaderDepth(self.data.main_col.root) - 1; - self.data.main_row.groupbys = old_col_root.groupbys.slice(0, new_groupby_length); + self.data.main_row.groupbys = old_row_root.groupbys.slice(0, new_groupby_length); }); }, /** -- cgit v1.2.3