Use user id instead of root to fill context rule

issue10348
review342261002
This commit is contained in:
Cédric Krier committed 2021-05-02 11:02:03 +02:00
1 parent 229faae98b
commit 11b34feb62
1 file changed
+2 -1
+2 -1
View File
@@ -74,8 +74,9 @@ class Rule(metaclass=PoolMeta):
Employee = pool.get('company.employee')
context = super()._get_context()
# Use root to avoid infinite loop when accessing user attributes
user_id = Transaction().user
with Transaction().set_user(0):
user = User(Transaction().user)
user = User(user_id)
if user.employee:
with Transaction().set_context(
_check_access=False, _datetime=None):