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...
}
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):