[FIX] filtering out of records which shouldn't be fetched/prefetched

A todo would only filter out records selectioned by the same field's caching,
it should filter out on the whole prefetching selection or an other field
could/would just add it back to the set of records to fetch (and lead to Bad
Things).

Note: this probably deserves a test somehow, but I'm not quite sure how the
todos thing works so...
This commit is contained in:
Xavier Morel 2014-07-11 14:07:05 +02:00
parent 785018cc9c
commit 269a6ee128
1 changed files with 6 additions and 4 deletions

View File

@ -3177,10 +3177,12 @@ class BaseModel(object):
}
empty = self.browse()
records = self.browse(set(itertools.chain.from_iterable(
(self._in_cache_without(field) - self.env.todo.get(field, empty)).ids
for field in (self._fields[name] for name in field_names)
)))
prefetch = set()
todo = set()
for field in (self._fields[name] for name in field_names):
prefetch.update(self._in_cache_without(field).ids)
todo.update(self.env.todo.get(field, empty).ids)
records = self.browse(prefetch - todo)
result = []
for sub_ids in cr.split_for_in_conditions(records.ids):