[FIX] models: improve implementation of _compute_display_name()

The method was expecting that name_get() returns complete and in-order values.
Because of this, some records in the recordset could end up without a value.
This commit is contained in:
Raphael Collet 2014-09-15 17:30:41 +02:00
parent a10cd334d0
commit 8fc7cf74fc
1 changed files with 3 additions and 2 deletions

View File

@ -1679,8 +1679,9 @@ class BaseModel(object):
@api.depends(lambda self: (self._rec_name,) if self._rec_name else ())
def _compute_display_name(self):
for i, got_name in enumerate(self.name_get()):
self[i].display_name = got_name[1]
names = dict(self.name_get())
for record in self:
record.display_name = names.get(record.id, False)
@api.multi
def name_get(self):