Cédric Krier pushed to branch branch/default at Tryton / Tryton


Commits:
1bb024e2 by Cédric Krier at 2023-04-03T10:54:50+02:00
Do not always enforce access on resource selection

When the reference field is validated (without check access), it should not
fail for SelectionValidationError if the user has no access to the resource.

Closes #12178
- - - - -


1 changed file:

- trytond/trytond/ir/resource.py


Changes:

=====================================
trytond/trytond/ir/resource.py
=====================================
@@ -34,8 +34,10 @@
         Model = pool.get('ir.model')
         ModelAccess = pool.get('ir.model.access')
         models = Model.get_name_items()
-        access = ModelAccess.get_access([m for m, _ in models])
-        return [(m, n) for m, n in models if access[m]['read']]
+        if Transaction().check_access:
+            access = ModelAccess.get_access([m for m, _ in models])
+            models = [(m, n) for m, n in models if access[m]['read']]
+        return models
 
     @classmethod
     def check_access(cls, ids, mode='read'):



View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/commit/1bb024e29dfae1cbb0487b1f66d325f3bb0059fa

-- 
View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/commit/1bb024e29dfae1cbb0487b1f66d325f3bb0059fa
You're receiving this email because of your account on foss.heptapod.net.


Reply via email to