From b87102f22eac494a2bba1deab811ba0e20906ba7 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 28 Jan 2013 14:06:40 +0100 Subject: [PATCH] [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 --- addons/web/static/src/js/pyeval.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/addons/web/static/src/js/pyeval.js b/addons/web/static/src/js/pyeval.js index 2c1b5ec9d7d..554c4aa7db0 100644 --- a/addons/web/static/src/js/pyeval.js +++ b/addons/web/static/src/js/pyeval.js @@ -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); }; /**