summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-02-15 13:46:23 +0100
committerChristophe Simonis <chs@odoo.com>2018-02-15 13:46:23 +0100
commit806f42b065b05e8b42fd18f2e8ea3eb8a41d2677 (patch)
tree3fc681e87e163d96ad425112a20c60c32cb5fd1b /addons/web/static/src
parentdf324c885771814efde7918cfecfa7940a38591f (diff)
parent8b9e854be4bfe3eda9a15368a864f7af606dee31 (diff)
[MERGE] forward port branch saas-11.2 up to 8b9e854be4b
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/chrome/action_manager.js28
1 files changed, 19 insertions, 9 deletions
diff --git a/addons/web/static/src/js/chrome/action_manager.js b/addons/web/static/src/js/chrome/action_manager.js
index cea75c56726..237ce1f1c96 100644
--- a/addons/web/static/src/js/chrome/action_manager.js
+++ b/addons/web/static/src/js/chrome/action_manager.js
@@ -172,20 +172,12 @@ var ActionManager = Widget.extend({
}
return this.dp.add($.when(def)).then(function () {
- action.jsID = _.uniqueId('action_');
- action.pushState = options.pushState;
-
// action.target 'main' is equivalent to 'current' except that it
// also clears the breadcrumbs
options.clear_breadcrumbs = action.target === 'main' ||
options.clear_breadcrumbs;
- // ensure that the context and domain are evaluated
- var context = new Context(self.userContext, options.additional_context, action.context);
- action.context = pyeval.eval('context', context);
- if (action.domain) {
- action.domain = pyeval.eval('domain', action.domain, action.context);
- }
+ self._preprocessAction(action, options);
return self._handleAction(action, options);
});
@@ -758,6 +750,24 @@ var ActionManager = Widget.extend({
return def;
},
/**
+ * Preprocesses the action before it is handled by the ActionManager
+ * (assigns a JS id, evaluates its context and domains, etc.).
+ *
+ * @param {Object} action
+ * @param {Object} options see @doAction options
+ */
+ _preprocessAction: function (action, options) {
+ action.jsID = _.uniqueId('action_');
+ action.pushState = options.pushState;
+
+ // ensure that the context and domain are evaluated
+ var context = new Context(this.userContext, options.additional_context, action.context);
+ action.context = pyeval.eval('context', context);
+ if (action.domain) {
+ action.domain = pyeval.eval('domain', action.domain, action.context);
+ }
+ },
+ /**
* Unlinks the given action and its controller from the internal structures
* and destroys its controllers.
*