changeset 10d0fee25b60 in trytond:5.0
details: https://hg.tryton.org/trytond?cmd=changeset;node=10d0fee25b60
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 6e10417259d9 -r 10d0fee25b60 trytond/ir/rule.py
--- a/trytond/ir/rule.py        Wed Dec 02 19:19:25 2020 +0100
+++ b/trytond/ir/rule.py        Wed Dec 16 20:41:21 2020 +0100
@@ -129,8 +129,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,

Reply via email to