Ensure records are readable also for constraints

review595004
This commit is contained in:
Cédric Krier committed 2012-11-28 22:34:10 +01:00
1 parent 9f916c1391
commit 1cdf1ffaef
1 file changed
+4 -4
+4 -4
View File
@@ -863,6 +863,10 @@ class ModelStorage(Model):
with Transaction().set_user(Transaction().context.get('user')):
return cls._validate(cls.browse(records))
# Ensure that records are readable
with Transaction().set_user(0, set_context=True):
records = cls.browse(records)
for record in records:
record.pre_validate()
@@ -897,10 +901,6 @@ class ModelStorage(Model):
return False
with Transaction().set_context(ctx_pref):
# Ensure that records are readable
with Transaction().set_user(0, set_context=True):
records = cls.browse(records)
for field_name, field in cls._fields.iteritems():
if isinstance(field, fields.Function) and \
not field.setter: