[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:
parent
80c2244f2e
commit
423fe4258e
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue