From 7d9d5287846fb261b6844229d4bf17cbf87e18b1 Mon Sep 17 00:00:00 2001 From: "PSI(OpenERP)" <> Date: Thu, 26 Aug 2010 14:10:08 +0530 Subject: [PATCH] [FIX] HR : Better improvement of previous commit on the critical error of res_user search if non-admin user is related to an employee bzr revid: jvo@tinyerp.com-20100826084008-5ikttnklrbkfxpez --- addons/hr/hr_department.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/hr/hr_department.py b/addons/hr/hr_department.py index 0f2c3a908ff..21946469ce4 100644 --- a/addons/hr/hr_department.py +++ b/addons/hr/hr_department.py @@ -130,8 +130,8 @@ class res_users(osv.osv): data_dept = obj_dept.read(cr, uid, ids_dept, ['manager_id'], context=context) parent_ids = map(lambda x: x['manager_id'][0], data_dept) cr.execute('SELECT res.user_id FROM hr_employee AS emp JOIN resource_resource AS res ON res.id=emp.resource_id \ - WHERE emp.id IN %s', (tuple(parent_ids),)) - parent_ids = [x[0] for x in cr.fetchall() if x[0]] + WHERE emp.id IN %s AND res.user_id IS NOT NULL', (tuple(parent_ids),)) + parent_ids = [x[0] for x in cr.fetchall()] result[user_id] = parent_ids return result