[IMP] mail: do not fetch hidden subtypes in follower widgets

bzr revid: tde@openerp.com-20140221112816-xhtc97az72ip355o
This commit is contained in:
Thibault Delavallée
2014-02-21 12:28:16 +01:00
parent 3a2d8d1496
commit e2eb37efe2
+11 -2
View File
@@ -186,8 +186,17 @@ class mail_thread(osv.AbstractModel):
# find current model subtypes, add them to a dictionary
subtype_obj = self.pool.get('mail.message.subtype')
subtype_ids = subtype_obj.search(cr, uid, ['|', ('res_model', '=', self._name), ('res_model', '=', False)], context=context)
subtype_dict = OrderedDict((subtype.name, OrderedDict(default=subtype.default, followed=False, parent_model=subtype.parent_id.res_model, id=subtype.id)) for subtype in subtype_obj.browse(cr, uid, subtype_ids, context=context))
subtype_ids = subtype_obj.search(
cr, uid, [
'&', ('hidden', '=', False), '|', ('res_model', '=', self._name), ('res_model', '=', False)
], context=context)
subtype_dict = OrderedDict(
(subtype.name, {
'default': subtype.default,
'followed': False,
'parent_model': subtype.parent_id and subtype.parent_id.res_model or self._name,
'id': subtype.id}
) for subtype in subtype_obj.browse(cr, uid, subtype_ids, context=context))
for id in ids:
res[id]['message_subtype_data'] = subtype_dict.copy()