[FIX] mail.message: be tolerant to messages linked to missing models

(Requested by the migration team)

bzr revid: odo@openerp.com-20121213161739-hszjd5yay2svtd3c
This commit is contained in:
Olivier Dony 2012-12-13 17:17:39 +01:00
parent a32f7d22b5
commit dad04babd3
1 changed files with 1 additions and 1 deletions

View File

@ -76,7 +76,7 @@ class mail_message(osv.Model):
# TDE note: regroup by model/ids, to have less queries to perform
result = dict.fromkeys(ids, False)
for message in self.read(cr, uid, ids, ['model', 'res_id'], context=context):
if not message.get('model') or not message.get('res_id'):
if not message.get('model') or not message.get('res_id') or not self.pool.get(message['model']):
continue
result[message['id']] = self._shorten_name(self.pool.get(message['model']).name_get(cr, SUPERUSER_ID, [message['res_id']], context=context)[0][1])
return result