From 423fe4258e945ff207d1f6a9155e3900281b0ef8 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Fri, 6 May 2011 11:37:04 +0200 Subject: [PATCH] [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 --- bin/addons/base/res/res_user.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/addons/base/res/res_user.py b/bin/addons/base/res/res_user.py index 7bf3674adc3..2ef2bb8d4d0 100644 --- a/bin/addons/base/res/res_user.py +++ b/bin/addons/base/res/res_user.py @@ -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