changeset e5ebc09bb052 in trytond:5.8
details: https://hg.tryton.org/trytond?cmd=changeset;node=e5ebc09bb052
description:
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
(grafted from 470e029c49eed8c844c5b0cb1961d8fcf1ada7da)
diffstat:
trytond/ir/rule.py | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diffs (16 lines):
diff -r 0f576a6b44f3 -r e5ebc09bb052 trytond/ir/rule.py
--- a/trytond/ir/rule.py Sat Dec 05 11:49:50 2020 +0100
+++ b/trytond/ir/rule.py Wed Dec 16 20:41:21 2020 +0100
@@ -136,8 +136,10 @@
@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,