[FIX] read user login and email with a read() instead of a browse()
this way, we prevent the auto-loading of all the user's fields which crashes the contact form while accessed by a portal user bzr revid: abo@openerp.com-20120918141724-fjhpu0m46ndgtble
This commit is contained in:
@@ -47,10 +47,10 @@ class crm_contact_us(osv.TransientModel):
|
||||
|
||||
@return current user's email if the user isn't "anonymous", None otherwise
|
||||
"""
|
||||
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
|
||||
user = self.pool.get('res.users').read(cr, uid, uid, ['login', 'email'], context)
|
||||
|
||||
if (user.login != 'anonymous'):
|
||||
return user.email
|
||||
if (user['login'] != 'anonymous'):
|
||||
return user['email']
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user