From 5510d808b8f1f33720412f48bbe31bda2df0e5ec Mon Sep 17 00:00:00 2001 From: Mathieu Duckerts-Antoine Date: Tue, 21 Aug 2018 17:23:21 +0200 Subject: [PATCH] [FIX] web: return information on pivot measures and groupbys This commit fixes a bad behavior of the pivot view. By the past, if there were no data to present in the pivot view, no information on the pivot view configuration was returned by the get function. This does not cause problems to the pivot renderer (by design) but causes problems elsewhere, for instance in a dashboard view that contains a pivot view. Indeed, at each update, the dashboard view reinstantiates its subviews, so that information can be lost if a subview is of pivot type. --- addons/web/static/src/js/views/pivot/pivot_model.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 3bc256611d9..0fd302c4abf 100644 --- a/addons/web/static/src/js/views/pivot/pivot_model.js +++ b/addons/web/static/src/js/views/pivot/pivot_model.js @@ -313,7 +313,12 @@ var PivotModel = AbstractModel.extend({ get: function (options) { var isRaw = options && options.raw; if (!this.data.has_data) { - return {has_data: false}; + return { + has_data: false, + colGroupBys: this.data.main_col.groupbys, + rowGroupBys: this.data.main_row.groupbys, + measures: this.data.measures, + }; } return { colGroupBys: this.data.main_col.groupbys,