Disable record rule when validating records

issue9796
review329451002
This commit is contained in:
Cédric Krier
2020-11-11 20:33:18 +01:00
parent 88e643518a
commit 2bedebbccc
+9
View File
@@ -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