From e2eb37efe2fd9c352c80ed43cb75fb11a027051d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 21 Feb 2014 12:28:16 +0100 Subject: [PATCH] [IMP] mail: do not fetch hidden subtypes in follower widgets bzr revid: tde@openerp.com-20140221112816-xhtc97az72ip355o --- addons/mail/mail_thread.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index e8197e52335..55e3ce67579 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -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()