[FIX] mail: avoid crashing message_post if the subtype does not exists anymore.

Using xmlid_to_res_id, subtype_id will be False if not found.

bzr revid: tde@openerp.com-20140411142214-nvvgkduzv51cc2eg
This commit is contained in:
Thibault Delavallée 2014-04-11 16:22:14 +02:00
parent e4d4c00312
commit e2dc6b782d
1 changed files with 1 additions and 2 deletions

View File

@ -1511,8 +1511,7 @@ class mail_thread(osv.AbstractModel):
if subtype:
if '.' not in subtype:
subtype = 'mail.%s' % subtype
ref = self.pool.get('ir.model.data').get_object_reference(cr, uid, *subtype.split('.'))
subtype_id = ref and ref[1] or False
subtype_id = self.pool.get('ir.model.data').xmlid_to_res_id(cr, uid, subtype)
# automatically subscribe recipients if asked to
if context.get('mail_post_autofollow') and thread_id and partner_ids: