From ec16432c5a96f460661c4a458dba40df93af09e6 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Thu, 17 Nov 2011 17:27:16 +0100 Subject: [PATCH] [FIX] Dashboard actions does not honor @context and @domain Currently naive implementation because it does not evaluate the domain & context. The dashboard is already overloaded with XHRs. We should use the xmo's python evaluator for context and domains if possible. lp bug: https://launchpad.net/bugs/876481 fixed bzr revid: fme@openerp.com-20111117162716-6zaoyn2kwv2ioj0w --- .../web_dashboard/static/src/js/dashboard.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/addons/web_dashboard/static/src/js/dashboard.js b/addons/web_dashboard/static/src/js/dashboard.js index ce52b426022..3bfd02e7bbe 100644 --- a/addons/web_dashboard/static/src/js/dashboard.js +++ b/addons/web_dashboard/static/src/js/dashboard.js @@ -218,10 +218,11 @@ openerp.web.form.DashBoard = openerp.web.form.Widget.extend({ }); }, on_load_action: function(result) { - var self = this; - var action_orig = _.extend({}, result.result); - var action = result.result; - var view_mode = this.actions_attrs[action.id]['view_mode']; + var self = this, + action_orig = _.extend({}, result.result), + action = result.result, + action_attrs = this.actions_attrs[action.id], + view_mode = action_attrs.view_mode; if (view_mode && view_mode != action.view_mode) { var action_view_mode = action.view_mode.split(','); action.views = _.map(view_mode.split(','), function(mode) { @@ -235,6 +236,16 @@ openerp.web.form.DashBoard = openerp.web.form.Widget.extend({ } }); } + + // TODO: Use xmo's python evaluator when ready + if (action_attrs.context) { + action.context = _.extend(action.context || {}, action_attrs.context); + } + if (action_attrs.domain) { + action.domain = action.domain || []; + action.domain.push.apply(action.domain, action_attrs.domain); + } + action.flags = { search_view : false, sidebar : false,