From eeeee85d1b1b57348315ca6bce09c4cfa199ccf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 16 Dec 2020 20:41:21 +0100 Subject: [PATCH] Use root user to evaluate user environment The user attributes may be restricted by other record rules so to evaluate the domain, we must have access to all attributes. issue9901 review333341002 --- trytond/ir/rule.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/trytond/ir/rule.py b/trytond/ir/rule.py index 1d6a4e2029..88208e1869 100644 --- a/trytond/ir/rule.py +++ b/trytond/ir/rule.py @@ -136,8 +136,10 @@ class Rule(ModelSQL, ModelView): @staticmethod def _get_context(): User = Pool().get('res.user') - user_id = Transaction().user - with Transaction().set_context(_check_access=False, _datetime=None): + transaction = Transaction() + user_id = transaction.user + with transaction.set_context(_check_access=False, _datetime=None), \ + transaction.set_user(0): user = EvalEnvironment(User(user_id), User) return { 'user': user,