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

【伯曼机械】试用结束日期默认为入职日期+合同期限

XMLWord打印

    • Icon: 技术问题 技术问题
    • 解决结果: 完成
    • Icon: High High
    • 202011
    • Y-易路产品-
    • beumertest
    • 人力资源等
    • 隐藏

      定时任务每日更新当天入职的员工的试用期结束日期:

      today = datetime.today().strftime('%Y-%m-%d')
      records = env['hr.employee'].search(cr, 1, [('hiredate', '=', today)])
      for record in records:
      employee = env['hr.employee'].browse(cr, 1, record)
      if employee.x_contract_deadline:
      if employee.x_contract_deadline.x_code=='1':
      reltive_time = relativedelta.relativedelta(months=1,days=1)
      elif employee.x_contract_deadline.x_code=='2':
      reltive_time = relativedelta.relativedelta(months=2,days=1)
      elif employee.x_contract_deadline.x_code in ('3','4'):
      reltive_time = relativedelta.relativedelta(months=3,days=1)
      else:
      continue
      trail_end = datetime.strptime(employee.hiredate,'%Y-%m-%d') + reltive_time
      employee.write(

      {"probation_date": trail_end.strftime('%Y-%m-%d')}

      )

      显示
      定时任务每日更新当天入职的员工的试用期结束日期: today = datetime.today().strftime('%Y-%m-%d') records = env ['hr.employee'] .search(cr, 1, [('hiredate', '=', today)] ) for record in records: employee = env ['hr.employee'] .browse(cr, 1, record) if employee.x_contract_deadline: if employee.x_contract_deadline.x_code=='1': reltive_time = relativedelta.relativedelta(months=1,days=1) elif employee.x_contract_deadline.x_code=='2': reltive_time = relativedelta.relativedelta(months=2,days=1) elif employee.x_contract_deadline.x_code in ('3','4'): reltive_time = relativedelta.relativedelta(months=3,days=1) else: continue trail_end = datetime.strptime(employee.hiredate,'%Y-%m-%d') + reltive_time employee.write( {"probation_date": trail_end.strftime('%Y-%m-%d')} )

      [试用期结束日期=入职日期+合同期限]
      通过入职日期和合同期限自动计算,即合同期限为1 year 则试用期为1个月,2 year 2个月,3 year 、unlimited 为6个月,其他 不计算

            grant.yang 杨光磊
            jason.zhou 周子深
            表决:
            0 为这个问题表决

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