[FIX] models: _in_cache_without may not return new ids

This commit is contained in:
Raphael Collet
2017-09-12 09:36:30 +02:00
parent 984b87c378
commit e7205b7992
+3 -1
View File
@@ -4678,7 +4678,9 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})):
(:class:`Field` instance), including ``self``.
Return at most ``limit`` records.
"""
recs = self.browse(self._prefetch[self._name]) - self.env.cache.get_records(self, field)
ids0 = self._prefetch[self._name]
ids1 = set(self.env.cache.get_records(self, field)._ids)
recs = self.browse([it for it in ids0 if it and it not in ids1])
if limit and len(recs) > limit:
recs = self + (recs - self)[:(limit - len(self))]
return recs