上传的图像用于项目: 'CST技术支持'
  1. CST技术支持
  2. SLAL2-1455

PRO写定时任务根据岗位汇报关系刷新员工汇报上级

XMLWord打印

    • Icon: Change Change
    • 解决结果: 完成
    • Icon: Medium Medium
    • 202012
    • Y-易路产品-
    • 基础通用功能
    • 隐藏

      records = env['hr.employee'].search([])
      current_date = datetime.datetime.now().strftime('%Y-%m-%d')
      for record in records:
      manager_employee_id = False
      job_employee = env['hr.employee'].search([('position_id','=',record.position_id.parent_position_id.id)])
      if job_employee and len(job_employee) == 1:
      manager_employee_id = job_employee.id
      parttime_position_emps = env['parttime.position.record'].search([('position_id','=',record.position_id.parent_position_id.id),('start_date','<=',current_date),
      '|',('end_date','>=',current_date),('end_date','=',False)])
      if parttime_position_emps and len(parttime_position_emps) == 1:
      manager_employee_id = parttime_position_emps.id
      if len(job_employee) > 1 or len(parttime_position_emps) > 1:
      manager_employee_id = False
      employee_job1 = env['emp.job'].search([('id','=',record.job_info_id.id)])
      if manager_employee_id and record.manager.id != manager_employee_id:
      emp = env['hr.employee'].search([('id','=',manager_employee_id)])
      log('员工姓名-%s,员工当前汇报上级-%s,员工修改后汇报上级-%s,员工的岗位和上级岗位 %s-%s' % (record.name,record.manager.name,emp.name,record.position_id.name,record.position_id.parent_position_id.name))
      employee_job1.update(

      {'manager_employee_id':manager_employee_id, }

      )

      显示
      records = env ['hr.employee'] .search([]) current_date = datetime.datetime.now().strftime('%Y-%m-%d') for record in records: manager_employee_id = False job_employee = env ['hr.employee'] .search( [('position_id','=',record.position_id.parent_position_id.id)] ) if job_employee and len(job_employee) == 1: manager_employee_id = job_employee.id parttime_position_emps = env ['parttime.position.record'] .search([('position_id','=',record.position_id.parent_position_id.id),('start_date','<=',current_date), '|',('end_date','>=',current_date),('end_date','=',False)]) if parttime_position_emps and len(parttime_position_emps) == 1: manager_employee_id = parttime_position_emps.id if len(job_employee) > 1 or len(parttime_position_emps) > 1: manager_employee_id = False employee_job1 = env ['emp.job'] .search( [('id','=',record.job_info_id.id)] ) if manager_employee_id and record.manager.id != manager_employee_id: emp = env ['hr.employee'] .search( [('id','=',manager_employee_id)] ) log('员工姓名-%s,员工当前汇报上级-%s,员工修改后汇报上级-%s,员工的岗位和上级岗位 %s-%s' % (record.name,record.manager.name,emp.name,record.position_id.name,record.position_id.parent_position_id.name)) employee_job1.update( {'manager_employee_id':manager_employee_id, } )

      长投学堂的员工汇报关系与岗位汇报关系一致,岗位处有上下级关系,需根据员工身上的岗位找到该岗位的上级岗位(需考虑兼岗情况),取员工岗位的上级岗位(需考虑兼岗)上的人员作为该员工的汇报上级。

      注:
      1、已和客户确认有下级岗位的岗位均为1岗1人,在查找上级过程中若出现多人的情况则该员工汇报上级为空
      2、长投存在兼岗情况,故在查找岗位上对应的员工时还需查找兼岗信息
      3、该定时任务一天执行一次,当发生人员调动或岗位变化时自动触发该定时任务

            wenqiang.liu 刘文强
            zhangpp 张萍萍
            表决:
            0 为这个问题表决

              创建日期:
              已更新:
              已解决: