summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js
diff options
context:
space:
mode:
authorXavier Morel <xmo@openerp.com>2012-11-27 16:41:21 +0100
committerXavier Morel <xmo@openerp.com>2012-11-27 16:41:21 +0100
commit5aa800ef42154dc9d749922836c9d17e511d99a8 (patch)
treed8017eb9bbb46cefb9db5ea2031d9a783bc6c0b2 /addons/web/static/src/js
parent6d27327d1417022170c951812adc24146cf449ed (diff)
[IMP] simplify action handlers: no need to eval_domains_and_contexts as do_action will evaluate them if and when needed
bzr revid: xmo@openerp.com-20121127154121-rsr4hxgmwmdrpdt7
Diffstat (limited to 'addons/web/static/src/js')
-rw-r--r--addons/web/static/src/js/views.js25
1 files changed, 8 insertions, 17 deletions
diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js
index 9fad16a58b0..8b71989cad9 100644
--- a/addons/web/static/src/js/views.js
+++ b/addons/web/static/src/js/views.js
@@ -1232,8 +1232,7 @@ instance.web.View = instance.web.Widget.extend({
};
var context = new instance.web.CompoundContext(dataset.get_context(), action_data.context || {});
- var handler = function (r) {
- var action = r;
+ var handler = function (action) {
if (action && action.constructor == Object) {
var ncontext = new instance.web.CompoundContext(context);
if (record_id) {
@@ -1244,18 +1243,10 @@ instance.web.View = instance.web.Widget.extend({
});
}
ncontext.add(action.context || {});
- return instance.web.pyeval.eval_domains_and_contexts({
- contexts: [ncontext],
- domains: []
- }).then(function (results) {
- action.context = results.context;
- /* niv: previously we were overriding once more with action_data.context,
- * I assumed this was not a correct behavior and removed it
- */
- return self.do_action(action, {
- on_close: result_handler,
- });
- }, null);
+ action.context = ncontext;
+ return self.do_action(action, {
+ on_close: result_handler,
+ });
} else {
self.do_action({"type":"ir.actions.act_window_close"});
return result_handler();
@@ -1277,15 +1268,15 @@ instance.web.View = instance.web.Widget.extend({
}
}
args.push(context);
- return dataset.call_button(action_data.name, args).done(handler);
+ return dataset.call_button(action_data.name, args).then(handler);
} else if (action_data.type=="action") {
return this.rpc('/web/action/load', {
action_id: action_data.name,
context: instance.web.pyeval.eval('context', context),
do_not_eval: true
- }).done(handler);
+ }).then(handler);
} else {
- return dataset.exec_workflow(record_id, action_data.name).done(handler);
+ return dataset.exec_workflow(record_id, action_data.name).then(handler);
}
},
/**