summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/chrome/action_manager.js
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2018-03-19 15:14:42 +0100
committerAaron Bohy <aab@odoo.com>2018-03-23 09:02:49 +0100
commit2a6ff8f8e47874151c45352f31b8206b3fab9456 (patch)
treeeef5f238c446fddd863937af36b7ba6cb3fc0f83 /addons/web/static/src/js/chrome/action_manager.js
parentee0605f405a84439bc71fde3f6bdc2da427ec774 (diff)
[IMP] web: ActionManager: load window actions without id
Actions can be loaded from the state of the url (e.g. when pressing F5). For window actions, it was working properly if the action id or a record id (i.e. for form views) was given. In other words, states like 'model=res.partner&view_type=kanban' couldn't be loaded. This can be explained by the fact that without an action id, the context and domain of the action couldn't be obtained. This rev. solves this problem by storing the current action into the sessionStorage, so that important information like context, domain and name can be retrieved if this action has to be restored (i.e. if the user refreshes the page).
Diffstat (limited to 'addons/web/static/src/js/chrome/action_manager.js')
-rw-r--r--addons/web/static/src/js/chrome/action_manager.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/addons/web/static/src/js/chrome/action_manager.js b/addons/web/static/src/js/chrome/action_manager.js
index c4d3f591545..bed9673d44c 100644
--- a/addons/web/static/src/js/chrome/action_manager.js
+++ b/addons/web/static/src/js/chrome/action_manager.js
@@ -358,6 +358,10 @@ var ActionManager = Widget.extend({
// toggle the fullscreen mode for actions in target='fullscreen'
self._toggleFullscreen();
+ // store the action into the sessionStorage so that it can be
+ // fully restored on F5
+ self.call('session_storage', 'setItem', 'current_action', action._originalAction);
+
return action;
})
.fail(function () {
@@ -763,6 +767,8 @@ var ActionManager = Widget.extend({
* @param {Object} options see @doAction options
*/
_preprocessAction: function (action, options) {
+ action._originalAction = JSON.stringify(action);
+
action.jsID = _.uniqueId('action_');
action.pushState = options.pushState;