From 0a1db46398d830c66c1d2eb6cc2e1c9941b3a449 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Mon, 22 Jul 2013 13:23:38 +0200 Subject: [PATCH] [IMP] sidebar: when cliking on an item, add active_domain along with active_id and active_ids. This domain is taken from the search view. bzr revid: tde@openerp.com-20130722112338-iws5ffxi77ykdvlu --- addons/web/static/src/js/views.js | 46 ++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index 48a108b2f01..67490a4652d 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -1183,25 +1183,39 @@ instance.web.Sidebar = instance.web.Widget.extend({ var active_ids_context = { active_id: ids[0], active_ids: ids, - active_model: self.getParent().dataset.model + active_model: self.getParent().dataset.model, }; - var c = instance.web.pyeval.eval('context', + + var search_view = self.getParent().ViewManager.searchview; + var search_data = search_view.build_search_data(); + var active_domain_done = instance.web.pyeval.eval_domains_and_contexts({ + domains: search_data.domains, + contexts: search_data.contexts, + group_by_seq: search_data.groupbys || [] + }).done(function (results) { + active_ids_context['active_domain'] = results.domain; + }); + + $.when(active_domain_done).done(function () { + var c = instance.web.pyeval.eval('context', new instance.web.CompoundContext( sidebar_eval_context, active_ids_context)); - self.rpc("/web/action/load", { - action_id: item.action.id, - context: c - }).done(function(result) { - result.context = new instance.web.CompoundContext( - result.context || {}, active_ids_context) - .set_eval_context(c); - result.flags = result.flags || {}; - result.flags.new_window = true; - self.do_action(result, { - on_close: function() { - // reload view - self.getParent().reload(); - }, + + self.rpc("/web/action/load", { + action_id: item.action.id, + context: c + }).done(function(result) { + result.context = new instance.web.CompoundContext( + result.context || {}, active_ids_context) + .set_eval_context(c); + result.flags = result.flags || {}; + result.flags.new_window = true; + self.do_action(result, { + on_close: function() { + // reload view + self.getParent().reload(); + }, + }); }); }); });