From a7b976c70455e9bb48f827cd45f3c1dc4887fac7 Mon Sep 17 00:00:00 2001 From: Simon Lejeune Date: Wed, 12 Oct 2016 22:15:22 +0200 Subject: [PATCH] [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: 46857d267b46c6ae91817231f8293403117bb75e `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). --- addons/web/static/src/js/view_manager.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/web/static/src/js/view_manager.js b/addons/web/static/src/js/view_manager.js index 6a8a162e144..ec7ce95313a 100644 --- a/addons/web/static/src/js/view_manager.js +++ b/addons/web/static/src/js/view_manager.js @@ -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); }, });