[IMP] base: Improve get_companymethod in res.user model

bzr revid: hmo@tinyerp.com-20100219110541-9g1oh5pg0krb2sve
This commit is contained in:
Harry (Open ERP) 2010-02-19 16:35:41 +05:30
parent 713ee22c90
commit 8cc67a3b2e
1 changed files with 3 additions and 2 deletions

View File

@ -229,8 +229,9 @@ class users(osv.osv):
def _get_company(self,cr, uid, context={}, uid2=False):
if not uid2:
uid2 = uid
user = self.pool.get('res.users').browse(cr, uid, uid2, context)
return user.company_id.id
user = self.pool.get('res.users').read(cr, uid, uid2, ['company_id'], context)
company_id = user.get('company_id', False)
return company_id and company_id[0] or False
def _get_menu(self,cr, uid, context={}):
ids = self.pool.get('ir.actions.act_window').search(cr, uid, [('usage','=','menu')])