summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorMartin Geubelle <mge@odoo.com>2018-02-14 16:06:42 +0100
committerMartin Geubelle <mge@odoo.com>2018-02-15 12:39:19 +0100
commit995d08b79a43ecf64c204fe3adba92383e1c22b7 (patch)
treec0ceb8ba23157ecd9085e9fce0d68ac01e7d3ee7 /addons/web/static/src
parent3b959c313d49889c8c81f37545d9028c63904484 (diff)
[FIX] web: factorize some `doAction` preprocessing
This preprocessing also needs to be done in Studio so it's factorized in a separate function.
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.
*