[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:
@@ -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]
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user