From 2bedebbccc3301fc7218943d64ed82a1ffd4f4bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 11 Nov 2020 20:33:18 +0100 Subject: [PATCH] Disable record rule when validating records issue9796 review329451002 --- trytond/model/modelstorage.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/trytond/model/modelstorage.py b/trytond/model/modelstorage.py index 1c5a4c3b7e..3a0000e0b8 100644 --- a/trytond/model/modelstorage.py +++ b/trytond/model/modelstorage.py @@ -81,6 +81,14 @@ def without_check_access(func): return wrapper +def without_rule(func): + @wraps(func) + def wrapper(*args, **kwargs): + with Transaction().set_user(0): + return func(*args, **kwargs) + return wrapper + + def cache_size(): return Transaction().context.get('_record_cache_size', _cache_record) @@ -1038,6 +1046,7 @@ class ModelStorage(Model): @classmethod @without_check_access + @without_rule def _validate(cls, records, field_names=None): pool = Pool() # Ensure that records are readable