summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorOlivier Dony <odo@openerp.com>2014-02-12 12:39:24 +0100
committerOlivier Dony <odo@openerp.com>2014-02-12 12:39:24 +0100
commit5d4f139df29fc30f38ee1b35c94d72e0e69bd8a7 (patch)
tree21446749377b1cdd349f3328f70c69edbbdf963e /addons
parentb6e708c1be72eb61584cb1da2e47fabb7086eed2 (diff)
[FIX] base_action_rule: attempt to reuse creator language when evaluating action filters
Some filters needs to be evaluated with the same language as their author, e.g. when searching on translatable field values. When a time-based action is processed by the scheduled task, we should thus attempt to reuse the same language as the author of the corresponding filter. bzr revid: odo@openerp.com-20140212113924-77sh4oj6dl2qwqka
Diffstat (limited to 'addons')
-rw-r--r--addons/base_action_rule/base_action_rule.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/addons/base_action_rule/base_action_rule.py b/addons/base_action_rule/base_action_rule.py
index 3d45407cb0e..37c4980528e 100644
--- a/addons/base_action_rule/base_action_rule.py
+++ b/addons/base_action_rule/base_action_rule.py
@@ -242,6 +242,13 @@ class base_action_rule(osv.osv):
if action.filter_id:
domain = eval(action.filter_id.domain)
ctx.update(eval(action.filter_id.context))
+ if 'lang' not in ctx:
+ # Filters might be language-sensitive, attempt to reuse creator lang
+ # as we are usually running this as super-user in background
+ [filter_meta] = action.filter_id.perm_read()
+ user_id = filter_meta['write_uid'] and filter_meta['write_uid'][0] or \
+ filter_meta['create_uid'][0]
+ ctx['lang'] = self.pool['res.users'].browse(cr, uid, user_id).lang
record_ids = model.search(cr, uid, domain, context=ctx)
# determine when action should occur for the records