From 99dd06cfd0f87e0bdd6be402f85328f1006667aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 12 Jun 2013 13:36:30 +0200 Subject: [PATCH] [FIX] [HACK] Delocate code about mail_thread inheritance from portal to mail_thread, because of the inheritance graph bug in trunk to sovle that makes this code not visible for hr.employee. bzr revid: tde@openerp.com-20130612113630-ao1dxpv0ax5n4xje --- addons/mail/mail_thread.py | 9 ++++++++- addons/portal/mail_mail.py | 11 ----------- 2 files changed, 8 insertions(+), 12 deletions(-) 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)