[FIX] models: store FailedValue in cache on log_access fields, too

This should fix an issue discovered by tde when reading all fields on a record
on which you don't have access right:
 - _read_from_database() fetches result and store it in cache
 - read() retrieves values from cache, starting with field 'create_date'...
 - ... which is not in cache, so prefetch that field, read it, which goes into
   an infinite loop

The problem is that _read_from_database() finds out that you don't have access
on the record, and stores a FailedValue in cache on all fields... except magic
fields. Fix the problem by storing the FailedValue on all fields but 'id'.
This commit is contained in:
Raphael Collet 2014-07-09 15:08:29 +02:00
parent ad262cad04
commit 643be98fcf
1 changed files with 1 additions and 1 deletions

View File

@ -5657,7 +5657,7 @@ class RecordCache(MutableMapping):
if args and isinstance(args[0], SpecialValue):
values = dict.fromkeys(self._recs._ids, args[0])
for name, field in self._recs._fields.iteritems():
if name not in MAGIC_COLUMNS:
if name != 'id':
self._recs.env.cache[field].update(values)
else:
return super(RecordCache, self).update(*args, **kwargs)