[FIX] res_user: allow user to switch to any company she belongs to.

Due to global ir.rules applied on res.company, a user should only
be able to see the child companies of the company he is currently
working in. However this needs to be bypassed when the user is
changing to a different company through user preferences.
It is safe to perform this check using super-user to bypass all
ir.rules.

bzr revid: odo@openerp.com-20110506093704-1vwxsqyz63lq40a1
This commit is contained in:
Olivier Dony 2011-05-06 11:37:04 +02:00
parent 80c2244f2e
commit 423fe4258e
1 changed files with 1 additions and 1 deletions

View File

@ -365,7 +365,7 @@ class users(osv.osv):
break
else:
if 'company_id' in values:
if not (values['company_id'] in self.read(cr, uid, uid, ['company_ids'], context=context)['company_ids']):
if not (values['company_id'] in self.read(cr, 1, uid, ['company_ids'], context=context)['company_ids']):
del values['company_id']
uid = 1 # safe fields only, so we write as super-user to bypass access rights