summaryrefslogtreecommitdiff
path: root/odoo/models.py
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-01-15 10:48:11 +0100
committerChristophe Simonis <chs@odoo.com>2019-01-15 10:48:11 +0100
commit28785f21e427f5d3ea23974e428bb5e856427625 (patch)
tree9a30d9856cc38079c4d0d7eb328e0142998032c1 /odoo/models.py
parenta449b063b0d55fdb3ae58d51c3b295a586c6d549 (diff)
parent6edfadbdd2abf13aed42a9cd7392ca42edbbc52e (diff)
[MERGE] forward port branch 10.0 up to 6edfadbdd2a
Diffstat (limited to 'odoo/models.py')
-rw-r--r--odoo/models.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/odoo/models.py b/odoo/models.py
index 83414270e7c..92e6cd7c3d6 100644
--- a/odoo/models.py
+++ b/odoo/models.py
@@ -3031,14 +3031,16 @@ class BaseModel(object):
# retrieve results from records; this takes values from the cache and
# computes remaining fields
+ self = self.with_prefetch(self._prefetch.copy())
data = {record: {'id': record.id} for record in self}
missing = set()
use_name_get = (load == '_classic_read')
for name in (stored + inherited + computed):
convert = self._fields[name].convert_to_read
- # read every field with prefetching limited to self; this avoids
+ # restrict the prefetching of self's model to self; this avoids
# computing fields on a larger recordset than self
- for record in self.with_prefetch():
+ self._prefetch[self._name] = set(self._ids)
+ for record in self:
try:
data[record][name] = convert(record[name], record, use_name_get)
except MissingError: