diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index 927e01e7406..41fcaf5adb7 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -1485,6 +1485,13 @@ class mail_thread(osv.AbstractModel): if context is None: context = {} + # TDE HACK: originally by MAT from portal/mail_mail.py but not working until the inheritance graph bug is not solved in trunk + # TDE FIXME: relocate in portal when it won't be necessary to reload the hr.employee model in an additional bridge module + if self.pool['res.groups']._all_columns.get('is_portal'): + user = self.pool.get('res.users').browse(cr, SUPERUSER_ID, uid, context=context) + if any(group.is_portal for group in user.groups_id): + return [] + threads = [] if removed_suggested_threads is None: removed_suggested_threads = [] @@ -1498,4 +1505,4 @@ class mail_thread(osv.AbstractModel): 'image_small': thread.image_small } threads.append(data) - return sorted(threads, key=lambda x: (x['popularity'], x['id']), reverse=True)[:3] \ No newline at end of file + return sorted(threads, key=lambda x: (x['popularity'], x['id']), reverse=True)[:3] diff --git a/addons/portal/mail_mail.py b/addons/portal/mail_mail.py index 84823bab747..e412732fdc9 100644 --- a/addons/portal/mail_mail.py +++ b/addons/portal/mail_mail.py @@ -44,14 +44,3 @@ class mail_mail(osv.Model): return _("""Access your messages and documents through our Customer Portal""") % signup_url else: return super(mail_mail, self)._get_partner_access_link(cr, uid, mail, partner=partner, context=context) - -class mail_thread_portal(osv.AbstractModel): - - _inherit = 'mail.thread' - - def get_suggested_thread(self, cr, uid, removed_suggested_threads=None, context=None): - """Overwrite to avoid showing suggestions for anonymous users""" - anonymous_group = self.pool.get('ir.model.data').get_object(cr, SUPERUSER_ID, 'portal', 'group_anonymous') - if uid in [user.id for user in anonymous_group.users]: - return [] - return super(mail_thread_portal, self).get_suggested_thread(cr, uid, removed_suggested_threads, context=context)