[FIX] Inject user context in all domain and context evaluation

Custom keys from user context may be used in action contexts (not just
e.g. searchview filters). For instance, have a custom key
context_salesteam (in the user model) and an action defining some
search default as a function of the salesteam.

In that case, the action's context evaluation (view.js:~275) will blow
up.

Ensure that does not happen.

Note: eval_contexts already injects user_context in the reduction of
contexts to evaluate. It should be possible to alter the reduction
function to avoid having to inject instance.session.user_context
through pyeval.context(), maybe by _.extend-ing ``result_context``
into ``evaluation_context`` at the *top* of the reduction function
rather than at its bottom?

bzr revid: xmo@openerp.com-20130128130640-ksyvxvx6rlc4820n
This commit is contained in:
Xavier Morel 2013-01-28 14:06:40 +01:00
parent b7f2a1979a
commit b87102f22e
1 changed files with 2 additions and 3 deletions

View File

@ -689,15 +689,14 @@ openerp.web.pyeval = function (instance) {
};
instance.web.pyeval.context = function () {
return {
uid: py.float.fromJSON(instance.session.uid),
return _.extend({
datetime: datetime,
context_today: context_today,
time: time,
relativedelta: relativedelta,
current_date: py.PY_call(
time.strftime, [py.str.fromJSON('%Y-%m-%d')]),
};
}, instance.session.user_context);
};
/**