From 404ac17e0e3ad75ba0306e64f5231260c2cd9aab Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Fri, 17 Feb 2012 10:35:41 +0100 Subject: [FIX] evaluate compound context from treeview before executing action not actually sure if ActionManager#do_action is supposed to get a literal or a nonliteral context at this point... but ViewManager(Action) does not seem to like nonlit contexts at all so... lp bug: https://launchpad.net/bugs/933360 fixed bzr revid: xmo@openerp.com-20120217093541-pudzg8x4u1dhbkjf --- addons/web/static/src/js/view_tree.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'addons/web/static/src/js/view_tree.js') diff --git a/addons/web/static/src/js/view_tree.js b/addons/web/static/src/js/view_tree.js index dea53793ffb..f0fc046a2f0 100644 --- a/addons/web/static/src/js/view_tree.js +++ b/addons/web/static/src/js/view_tree.js @@ -224,21 +224,25 @@ openerp.web.TreeView = openerp.web.View.extend(/** @lends openerp.web.TreeView# active_model: self.dataset.model, active_id: id, active_ids: [id]}; - this.rpc('/web/treeview/action', { + return this.rpc('/web/treeview/action', { id: id, model: this.dataset.model, context: new openerp.web.CompoundContext( this.dataset.get_context(), local_context) - }, function (actions) { + }).pipe(function (actions) { if (!actions.length) { return; } var action = actions[0][2]; var c = new openerp.web.CompoundContext(local_context); if (action.context) { c.add(action.context); } - action.context = c; - self.do_action(action); - }); + return self.rpc('/web/session/eval_domain_and_context', { + contexts: [c], domains: [] + }).pipe(function (res) { + action.context = res.context; + return self.do_action(action); + }, null); + }, null); }, // show & hide the contents -- cgit v1.2.3 From 739f719ad6f26c007deb6b48134734588538bcbe Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 27 Feb 2012 08:37:21 +0100 Subject: [UP] py.parse 0.2 to py.js 0.4 ~ should probably go through a testing phase (checking its result against that of eval_domain_and_context) for a while, but apart from that it's supposed to work. 'stdlib' stuff (datetime.date.today, datetime.timedelta, time.localtime, time.time, time.strftime) still need to be written. Isn't there also a dateutil.relativedeleta somewhere? Anyway that needs to be done and the various evaluation contexts need to be defined, but the valuator itself should mostly work. bzr revid: xmo@openerp.com-20120227073721-nkgeiqacbzch8xev --- addons/web/static/src/js/view_tree.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/web/static/src/js/view_tree.js') diff --git a/addons/web/static/src/js/view_tree.js b/addons/web/static/src/js/view_tree.js index dea53793ffb..1c6694ed930 100644 --- a/addons/web/static/src/js/view_tree.js +++ b/addons/web/static/src/js/view_tree.js @@ -146,7 +146,7 @@ openerp.web.TreeView = openerp.web.View.extend(/** @lends openerp.web.TreeView# var pair = this.colors[i], color = pair[0], expression = pair[1]; - if (py.evaluate(expression, _.extend({bool: py.bool}, context))) { + if (py.evaluate(expression, context).toJSON()) { return 'color: ' + color + ';'; } // TODO: handle evaluation errors -- cgit v1.2.3