[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
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user