summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/pyeval.js
diff options
context:
space:
mode:
authorXavier Morel <xmo@openerp.com>2013-01-28 14:06:40 +0100
committerXavier Morel <xmo@openerp.com>2013-01-28 14:06:40 +0100
commitb87102f22eac494a2bba1deab811ba0e20906ba7 (patch)
tree1a4b678c346b07da6133346b595a49db7a08f01a /addons/web/static/src/js/pyeval.js
parentb7f2a1979a13b7d5460b59df50d6c8714832c11f (diff)
[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
Diffstat (limited to 'addons/web/static/src/js/pyeval.js')
-rw-r--r--addons/web/static/src/js/pyeval.js5
1 files 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);
};
/**