[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:
Antonin Bourguignon
2012-09-18 16:17:24 +02:00
parent df5b465617
commit bbae9cdc00
+3 -3
View File
@@ -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