[FIX] web: browser's back button while in the same action

When you browse through the views of an action and then hit the back button,
the view does not change. For example, go to the customers kanban, click
on a customer, hit back, you're still in the customer form view.

related rev: 46857d267b

`do_load_state` is called when you hit f5 or press the back button on
your browser. The related rev took care of fixing the ugly part that
make the webclient goes trough the multi record view then the mono
record view when you hit f5 on a mono record view.

In this context, it removed the code in view manager's `do_load_state` that
switched the mode of the action if it isn't the same the one the web client
is trying to restore from the state (because now the correct mode is loaded).

However, if you hit the back button while the previous view is in the same
action, it obviously doesn't switch the mode anymore and you're facing
the same view.

The issue is fixed by restoring the switch_mode in the view manager's
`do_load_state` (without its oudated comment).
This commit is contained in:
Simon Lejeune
2016-10-13 14:38:33 +02:00
parent 89700eb771
commit a7b976c704
+3
View File
@@ -458,6 +458,9 @@ var ViewManager = Widget.extend(ControlPanelMixin, {
}
},
do_load_state: function(state, warm) {
if (state.view_type && state.view_type !== this.active_view.type) {
this.switch_mode(state.view_type, true);
}
this.active_view.controller.do_load_state(state, warm);
},
});