[IMP] models: prefetch fields with groups (those to which user has access)

This commit is contained in:
Raphael Collet 2014-09-01 11:43:33 +02:00
parent 4f11ff379a
commit f2f1f3465d
2 changed files with 4 additions and 2 deletions

View File

@ -3156,7 +3156,9 @@ class BaseModel(object):
# here we can optimize: prefetch all classic and many2one fields
fnames = set(fname
for fname, fcolumn in self._columns.iteritems()
if fcolumn._prefetch)
if fcolumn._prefetch
if not fcolumn.groups or self.user_has_groups(fcolumn.groups)
)
# fetch records with read()
assert self in records and field.name in fnames

View File

@ -120,7 +120,7 @@ class _column(object):
# prefetch only if self._classic_write, not self.groups, and not
# self.deprecated
if not self._classic_write or self.groups or self.deprecated:
if not self._classic_write or self.deprecated:
self._prefetch = False
def to_field(self):