From e7205b7992f55ef2cf9df9d8f2b71fafe9ed6348 Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Mon, 11 Sep 2017 14:57:19 +0200 Subject: [PATCH] [FIX] models: `_in_cache_without` may not return new ids --- odoo/models.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/odoo/models.py b/odoo/models.py index 9c60a0da2bc..996ff54d611 100644 --- a/odoo/models.py +++ b/odoo/models.py @@ -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