summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vermylen <dve@odoo.com>2017-04-05 11:24:02 +0200
committerDenis Vermylen <dve@odoo.com>2017-04-05 11:24:02 +0200
commit7787e91d68ad7b71cb756d30cbcd66a8ac8d70e8 (patch)
tree69fa296add0a4fe8ae05eabdefa7aa3eeccfbfdf
parent644469eafe7a081c924f0562798023705187dacf (diff)
[FIX] models: don't call name_get on falsy records
The call of the name_get on records with falsy ids was unnecessary as it wasn't used afterwards and could lead to errors if a name_get doesn't handle falsy records. solves https://github.com/odoo/odoo/pull/16244
-rw-r--r--odoo/models.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/odoo/models.py b/odoo/models.py
index 848e9cc9b69..c6e265e4f86 100644
--- a/odoo/models.py
+++ b/odoo/models.py
@@ -2043,7 +2043,7 @@ class BaseModel(object):
def _read_group_resolve_many2one_fields(self, data, fields):
many2onefields = {field['field'] for field in fields if field['type'] == 'many2one'}
for field in many2onefields:
- ids_set = {d[field] for d in data}
+ ids_set = {d[field] for d in data if d[field]}
m2o_records = self.env[self._fields[field].comodel_name].browse(ids_set)
data_dict = dict(m2o_records.name_get())
for d in data: