From 90d6069a536115ba1e29f801433da5a4df022bbf Mon Sep 17 00:00:00 2001 From: "tfr@openerp.com" <> Date: Mon, 6 Feb 2012 11:14:48 +0100 Subject: [PATCH] [FIX] use employee id to lookup into the user table, now use the corresponding user_id lp bug: https://launchpad.net/bugs/925572 fixed bzr revid: tfr@openerp.com-20120206101448-4o8jo81chiad5b2j --- addons/project_planning/project_planning.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/addons/project_planning/project_planning.py b/addons/project_planning/project_planning.py index 419b8474d21..f34e28e4be5 100644 --- a/addons/project_planning/project_planning.py +++ b/addons/project_planning/project_planning.py @@ -48,6 +48,12 @@ class one2many_mod3(fields.one2many): class report_account_analytic_planning(osv.osv): _name = "report_account_analytic.planning" _description = "Planning" + + def emp_to_users(self, cr, uid, ids, context=None): + employees = self.pool.get('hr.employee').browse(cr, uid, ids, context=context) + user_ids = [e.user_id.id for e in employees if e.user_id] + return user_ids + def _child_compute(self, cr, uid, ids, name, args, context=None): obj_dept = self.pool.get('hr.department') @@ -64,8 +70,9 @@ class report_account_analytic_planning(osv.osv): ids_dept = obj_dept.search(cr, uid, [('id', 'child_of', mgnt_dept_ids)], context=context) if ids_dept: data_dept = obj_dept.read(cr, uid, ids_dept, ['member_ids'], context=context) - children = map(lambda x: x['member_ids'], data_dept) - children = tools.flatten(children) + emp_children = map(lambda x: x['member_ids'], data_dept) + emp_children = tools.flatten(emp_children) + children = self.emp_to_users(cr, uid, emp_children, context=context) children = obj_user.search(cr, uid, [('id', 'in', children),('active', '=', True)], context=context) if user_id in children: children.remove(user_id)