if self.employee_id.department_id.parent_department_id:
result = self.employee_id.department_id.parent_department_id.manager_id.user_id
2. 加班单据上查询员工的二级部门的组织单元经理
department = self.employee_id.department_id
while department.parent_department_id.parent_department_id:
department = department.parent_department_id
if department and department.manager_id:
result = department.manager_id.user_id
1. 查询员工上级部门的组织单元经理;
if self.employee_id.department_id.parent_department_id:
result = self.employee_id.department_id.parent_department_id.manager_id.user_id
2. 加班单据上查询员工的二级部门的组织单元经理
department = self.employee_id.department_id
while department.parent_department_id.parent_department_id:
department = department.parent_department_id
if department and department.manager_id:
result = department.manager_id.user_id