[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.
This commit is contained in:
Khoi Nguyen
2017-08-17 10:51:50 +02:00
parent 68d0ca03da
commit 15f14cee2a
@@ -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) {