[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
This commit is contained in:
Fabien Meghazi 2011-11-17 17:27:16 +01:00
parent 7c629a31cc
commit ec16432c5a
1 changed files with 15 additions and 4 deletions

View File

@ -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,