[IMP] models: prefetch fields with groups (those to which user has access)
This commit is contained in:
parent
4f11ff379a
commit
f2f1f3465d
|
@ -3156,7 +3156,9 @@ class BaseModel(object):
|
||||||
# here we can optimize: prefetch all classic and many2one fields
|
# here we can optimize: prefetch all classic and many2one fields
|
||||||
fnames = set(fname
|
fnames = set(fname
|
||||||
for fname, fcolumn in self._columns.iteritems()
|
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()
|
# fetch records with read()
|
||||||
assert self in records and field.name in fnames
|
assert self in records and field.name in fnames
|
||||||
|
|
|
@ -120,7 +120,7 @@ class _column(object):
|
||||||
|
|
||||||
# prefetch only if self._classic_write, not self.groups, and not
|
# prefetch only if self._classic_write, not self.groups, and not
|
||||||
# self.deprecated
|
# self.deprecated
|
||||||
if not self._classic_write or self.groups or self.deprecated:
|
if not self._classic_write or self.deprecated:
|
||||||
self._prefetch = False
|
self._prefetch = False
|
||||||
|
|
||||||
def to_field(self):
|
def to_field(self):
|
||||||
|
|
Loading…
Reference in New Issue