[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
This commit is contained in:
Thibault Delavallée
2013-06-12 13:36:30 +02:00
parent 7d2344bc36
commit 99dd06cfd0
2 changed files with 8 additions and 12 deletions
+8 -1
View File
@@ -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]
return sorted(threads, key=lambda x: (x['popularity'], x['id']), reverse=True)[:3]
-11
View File
@@ -44,14 +44,3 @@ class mail_mail(osv.Model):
return _("""<small>Access your messages and documents through <a style='color:inherit' href="%s">our Customer Portal</a></small>""") % 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)