From 15f14cee2aaa5881524301dfad1e98e0cc47e293 Mon Sep 17 00:00:00 2001 From: Khoi Nguyen Date: Thu, 17 Aug 2017 10:38:03 +0200 Subject: [PATCH] [FIX] web: unexpected 'group by' when switching away from Kanban Currently, the 'environment group by', if previously empty, is set to a view-specific default value when filtering in a Kanban view. This then causes an unexpected 'group by' when switching away from a Kanban view, since the expected behaviour is to only take a Kanban 'group by' into account if it was explicitely set by the user. This is caused by the fact that the 'search' event triggers a view reload which takes the environment as parameter, while the Kanban view reload overrides the group by (arrays are passed by reference). Both result in an undesired modification of the enviroment. We fix this bug by giving a shallow copy of the environment as parameter when triggering the view reload. --- addons/web/static/src/js/chrome/view_manager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/js/chrome/view_manager.js b/addons/web/static/src/js/chrome/view_manager.js index 25f320670e9..30ad6ad008a 100644 --- a/addons/web/static/src/js/chrome/view_manager.js +++ b/addons/web/static/src/js/chrome/view_manager.js @@ -26,7 +26,7 @@ var ViewManager = Widget.extend(ControlPanelMixin, { search: function(event) { var d = event.data; _.extend(this.env, this._process_search_data(d.domains, d.contexts, d.groupbys)); - this.active_view.controller.reload(this.env); + this.active_view.controller.reload(_.extend({}, this.env)); }, switch_view: function(event) { if ('res_id' in event.data) {