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

【高顿生产】员工转正&定时任务:增加定时任务,转正日期前45天生成转正单据草稿,

XMLWord打印

    • Icon: Change Change
    • 解决结果: 完成
    • Icon: High High
    • 202104
    • G-高顿教育-Y2018097
    • 高顿,生产GAODUN,测试GAODUNUAT
    • 基础通用功能
    • 隐藏

      代码如下:

      run_time_since = (datetime.now() + relativedelta.relativedelta(days=45)).strftime('%Y-%m-%d')
      records = env['hr.employee'].search(cr, 1, [('work_activity','!=', 'turn_over'),('active','=', True),('activated','=',True),('is_probation','=',True),('probation_date','<=', run_time_since), ('work_activity','in', ('on_boarding','in_service'))])
      val_dict = {}
      if records:
      for record in records:

      1. hr_termination = env['hr.termination'].search(cr, 1, [('employee_id','=', record),('active','=', True),('state','in', ['done'])])
      2. employee_dimission = env['employee.dimission'].search(cr, 1, [('employee_id','=', record),('active','=', True),('state','in', ['done'])])
      3. if not hr_termination and not employee_dimission:
        employee = env['hr.employee'].browse(cr, 1, record)
        company_id = employee.department_id.company_id.id
        dep_manager = employee.dep_manager.id
        department_id = employee.department_id.id
        employee_id = record
        employee_number = employee.employee_number
        english_name = employee.first_name
        job_id = employee.job_id.id
        parent_id = employee.parent_id.id
        probation_date = employee.probation_date
        val_dict = { "atachment_ids":[], "company_id":company_id, "dep_manager":dep_manager, "department_id":department_id, "employee_id":employee_id, "employee_number":employee_number, "english_name":english_name, "job_id":job_id, "note":False, "parent_id":parent_id, "probation_date":probation_date, "state":"draft" }

        probation_bp = env['employee.probation'].search(cr, 1, [('employee_id', '=', record),('active', '=', True)])
        if not probation_bp:
        probation_bp_rec = env['employee.probation'].create(cr, 1, val_dict)

      显示
      代码如下: run_time_since = (datetime.now() + relativedelta.relativedelta(days=45)).strftime('%Y-%m-%d') records = env ['hr.employee'] .search(cr, 1, [('work_activity','!=', 'turn_over'),('active','=', True),('activated','=',True),('is_probation','=',True),('probation_date','<=', run_time_since), ('work_activity','in', ('on_boarding','in_service'))] ) val_dict = {} if records: for record in records: hr_termination = env ['hr.termination'] .search(cr, 1, [('employee_id','=', record),('active','=', True),('state','in', ['done'] )]) employee_dimission = env ['employee.dimission'] .search(cr, 1, [('employee_id','=', record),('active','=', True),('state','in', ['done'] )]) if not hr_termination and not employee_dimission: employee = env ['hr.employee'] .browse(cr, 1, record) company_id = employee.department_id.company_id.id dep_manager = employee.dep_manager.id department_id = employee.department_id.id employee_id = record employee_number = employee.employee_number english_name = employee.first_name job_id = employee.job_id.id parent_id = employee.parent_id.id probation_date = employee.probation_date val_dict = { "atachment_ids":[], "company_id":company_id, "dep_manager":dep_manager, "department_id":department_id, "employee_id":employee_id, "employee_number":employee_number, "english_name":english_name, "job_id":job_id, "note":False, "parent_id":parent_id, "probation_date":probation_date, "state":"draft" } probation_bp = env ['employee.probation'] .search(cr, 1, [('employee_id', '=', record),('active', '=', True)] ) if not probation_bp: probation_bp_rec = env ['employee.probation'] .create(cr, 1, val_dict)

      *员工转正&定时任务:*增加定时任务,转正日期前45天生成转正单据草稿。

      关键参数:提前45天、所有在职且未到转正日期的员工

      已于客户确认,生成单据时不需要过滤有在途离职单据的人员

            grant.yang 杨光磊
            karen.li 李帅
            表决:
            0 为这个问题表决

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