[FIX] evaluate compound context from treeview before executing action
authorXavier Morel <xmo@openerp.com>
Fri, 17 Feb 2012 09:35:41 +0000 (10:35 +0100)
committerXavier Morel <xmo@openerp.com>
Fri, 17 Feb 2012 09:35:41 +0000 (10:35 +0100)
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

index dea5379..f0fc046 100644 (file)
@@ -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