[FIX] read user login and email with a read() instead of a browse()
authorAntonin Bourguignon <abo@openerp.com>
Tue, 18 Sep 2012 14:17:24 +0000 (16:17 +0200)
committerAntonin Bourguignon <abo@openerp.com>
Tue, 18 Sep 2012 14:17:24 +0000 (16:17 +0200)
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

addons/portal_crm/wizard/contact.py

index 755b422..37e6a0c 100644 (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