diff options
| author | Christophe Simonis <chs@odoo.com> | 2016-10-17 15:17:48 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2016-10-17 15:17:48 +0200 |
| commit | e8e4145c998c335d00a48a0b2a7a9e961b3f3983 (patch) | |
| tree | 3433987f901989e6103f30d165580a87ce4f658f /addons/web/static/src/js/web_client.js | |
| parent | 81ec36a709188e1e8fe0fb28e0673396d9b51e4d (diff) | |
| parent | ba6ca788fd80a1b963b8059bd287317399389283 (diff) | |
[MERGE] forward port branch saas-11 up to ba6ca78
Diffstat (limited to 'addons/web/static/src/js/web_client.js')
| -rw-r--r-- | addons/web/static/src/js/web_client.js | 46 |
1 files changed, 29 insertions, 17 deletions
diff --git a/addons/web/static/src/js/web_client.js b/addons/web/static/src/js/web_client.js index 8157270638e..a364e2a2de3 100644 --- a/addons/web/static/src/js/web_client.js +++ b/addons/web/static/src/js/web_client.js @@ -112,25 +112,37 @@ return AbstractWebClient.extend({ } }, on_hashchange: function(event) { + if (this._ignore_hashchange) { + this._ignore_hashchange = false; + return; + } + var self = this; - var stringstate = event.getState(false); - if (!_.isEqual(this._current_state, stringstate)) { - var state = event.getState(true); - if(!state.action && state.menu_id) { - self.menu.is_bound.done(function() { - self.menu.menu_click(state.menu_id); - }); - } else { - state._push_me = false; // no need to push state back... - this.action_manager.do_load_state(state, !!this._current_state).then(function () { - var action = self.action_manager.get_inner_action(); - if (action) { - self.menu.open_action(action.action_descr.id); - } - }); + this.clear_uncommitted_changes().then(function () { + var stringstate = event.getState(false); + if (!_.isEqual(self._current_state, stringstate)) { + var state = event.getState(true); + if(!state.action && state.menu_id) { + self.menu.is_bound.done(function() { + self.menu.menu_click(state.menu_id); + }); + } else { + state._push_me = false; // no need to push state back... + self.action_manager.do_load_state(state, !!self._current_state).then(function () { + var action = self.action_manager.get_inner_action(); + if (action) { + self.menu.open_action(action.action_descr.id); + } + }); + } } - } - this._current_state = stringstate; + self._current_state = stringstate; + }, function () { + if (event) { + self._ignore_hashchange = true; + window.location = event.originalEvent.oldURL; + } + }); }, on_menu_action: function(options) { var self = this; |
