代码:
1.HRBP节点,取离职员工所在部门页面上的HRBP字段人员,作为审批角色;
result = self.employee_id.job_info_id.department_id.hrbp_id.user_id
2.财务审批(确认报销/付款)节点,通过员工主数据_基础信息_员工标签为条件判断:
(1)大陆员工(A0001) 由岗位编码 900007 审批;
(2)香港/海外员工(A0002)由编码900003岗位审批
emp = None
if self.employee_id.x_category_ids=='A0001':
emp = env['hr.employee'].search([('job_info_id.position_id.code','=','900007'),('active','=', True),('job_info_id.employee_status.code','=','active')],limit=1)
elif self.employee_id.x_category_ids=='A0002':
emp = env['hr.employee'].search([('job_info_id.position_id.code','=','900003'),('active','=', True),('job_info_id.employee_status.code','=','active')],limit=1)
if emp:
result = emp.user_id
3.财务负责人节点,通过员工主数据_基础信息_员工标签为条件判断:
(1)大陆员工(A0001) 由财务部(D00008),部门负责人审批;
(2)香港/海外员工(A0002) 由财务部(D00008)和财务部(D00040),部门负责人审批,会签;
emp = None
result = []
if self.employee_id.x_category_ids=='A0001':
dep = env['hr.department'].search([('code','=','D00008')],limit=1)
result.append(dep.manager_id.user_id.id)
elif self.employee_id.x_category_ids=='A0002':
deps = env['hr.department'].search([('code','in',['D00008','D00040'])])
for dep in deps:
result.append(dep.manager_id.user_id.id)
4.HR负责人节点,通过员工主数据_基础信息_员工标签为条件判断:
(1)大陆员工(A0001) 由岗位编码 P000152 审批;
(2)香港/海外员工(A0002)由编码 900102岗位 和 P000152岗位审批,会签
emp = None
if self.employee_id.x_category_ids=='A0001':
emp = env['hr.employee'].search([('job_info_id.position_id.code','=','P000152'),('active','=', True),('job_info_id.employee_status.code','=','active')],limit=1)
elif self.employee_id.x_category_ids=='A0002':
emp = env['hr.employee'].search([('job_info_id.position_id.code','in',['900102','P000152']),('active','=', True),('job_info_id.employee_status.code','=','active')],limit=1)
if emp:
result = emp.mapped('user_id')
5.算法和数据部负责人节点:算法和数据部(D00007),部门负责人审批;
dep = env['hr.department'].search([('code','=','D00007')],limit=1)
if dep:
result = dep.manager_id.user_id
6.IT和运维部负责人节点:IT和运维部(D00024),部门负责人审批;
dep = env['hr.department'].search([('code','=','D00024')],limit=1)
if dep:
result = dep.manager_id.user_id
7.平台产品技术线负责人:平台产品技术线(GS00081),部门负责人审批;
dep = env['hr.department'].search([('code','=','GS00081')],limit=1)
if dep:
result = dep.manager_id.user_id