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

好孩子正式环境:员工自助离职和HR离职中社保截止月和公积金截止月设置

XMLWord打印

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

      employee_id = kwargs.setdefault('values', {}).get('employee_id',None) or result.get('employee_id',None)
      employee = env['hr.employee'].search([('id','=',employee_id.id)])
      if employee.employee_type_rep.code in ['ET02','ET03','ET04']:
      result.update(

      { 'housing_fund_end_month': '', 'social_security_end_month':'' }

      )
      else:
      leave_time = kwargs.setdefault('values', {}).get('leave_time',None) or result.get('leave_time',None)
      if int(leave_time[-2:]) <20:
      new_month = str(int(leave_time[5:7])-1)
      if int(new_month)<=0:
      new_month = '12'
      new_day = str(int(leave_time[0:4])1)''+str(new_month)'-01'
      next_month = toolkits.datetime.datetime.strptime(new_day,'%Y-%m-%d').replace(day=28) + toolkits.datetime.timedelta(days=4)
      new_day = (next_month - toolkits.datetime.timedelta(days=next_month.day)).strftime('%Y-%m-%d')
      if len(new_month)<2:
      new_month = '0'+new_month
      new_day = leave_time[0:5]str(new_month)'-01'
      next_month = toolkits.datetime.datetime.strptime(new_day,'%Y-%m-%d').replace(day=28) + toolkits.datetime.timedelta(days=4)
      new_day = (next_month - toolkits.datetime.timedelta(days=next_month.day)).strftime('%Y-%m-%d')
      result.update(

      { 'social_security_end_month':new_day, 'housing_fund_end_month':new_day }

      )
      elif int(leave_time[-2:]) >= 20:
      next_month = toolkits.datetime.datetime.strptime(leave_time,'%Y-%m-%d').replace(day=28) + toolkits.datetime.timedelta(days=4)
      new_day = (next_month - toolkits.datetime.timedelta(days=next_month.day)).strftime('%Y-%m-%d')
      result.update(

      { 'social_security_end_month':new_day, 'housing_fund_end_month':new_day }

      )

      显示
      employee_id = kwargs.setdefault('values', {}).get('employee_id',None) or result.get('employee_id',None) employee = env ['hr.employee'] .search( [('id','=',employee_id.id)] ) if employee.employee_type_rep.code in ['ET02','ET03','ET04'] : result.update( { 'housing_fund_end_month': '', 'social_security_end_month':'' } ) else: leave_time = kwargs.setdefault('values', {}).get('leave_time',None) or result.get('leave_time',None) if int(leave_time [-2:] ) <20: new_month = str(int(leave_time [5:7] )-1) if int(new_month)<=0: new_month = '12' new_day = str(int(leave_time [0:4] ) 1) ' '+str(new_month) '-01' next_month = toolkits.datetime.datetime.strptime(new_day,'%Y-%m-%d').replace(day=28) + toolkits.datetime.timedelta(days=4) new_day = (next_month - toolkits.datetime.timedelta(days=next_month.day)).strftime('%Y-%m-%d') if len(new_month)<2: new_month = '0'+new_month new_day = leave_time [0:5] str(new_month) '-01' next_month = toolkits.datetime.datetime.strptime(new_day,'%Y-%m-%d').replace(day=28) + toolkits.datetime.timedelta(days=4) new_day = (next_month - toolkits.datetime.timedelta(days=next_month.day)).strftime('%Y-%m-%d') result.update( { 'social_security_end_month':new_day, 'housing_fund_end_month':new_day } ) elif int(leave_time [-2:] ) >= 20: next_month = toolkits.datetime.datetime.strptime(leave_time,'%Y-%m-%d').replace(day=28) + toolkits.datetime.timedelta(days=4) new_day = (next_month - toolkits.datetime.timedelta(days=next_month.day)).strftime('%Y-%m-%d') result.update( { 'social_security_end_month':new_day, 'housing_fund_end_month':new_day } )

      如果员工的确认离职日期:
      1)当前月20号(含)之后离职人员,社保截止月/公积金截至月显示当前月最后一天。
      2)反之当前月20号之前离职人员,社保截止月/公积金截至月显示上月最后一天。

            wenqiang.liu 刘文强
            lugx 卢桂香
            表决:
            0 为这个问题表决

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