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

Armani扣薪病假申请逻辑修改

XMLWord打印

    • Icon: Change Change
    • 解决结果: 完成
    • Icon: Medium Medium
    • 202006
    • Y-易路产品-
    • GASH
    • 时间管理
    • 隐藏

      result = True
      if record.holiday_type_id.code == 'L019' and record.employee_id.departure_time:
      raise ValidationError('根据公司政策,已提离职不能申请带薪病假。')
      elif record.holiday_type_id.code == 'L007' and not record.employee_id.departure_time:
      if record.start_date >= record.employee_id.hiredate + relativedelta.relativedelta(months=3):
      paid_leave_type = env['hr.holiday.type'].search([('code', '=', 'L019')], limit=1)
      inquirys = env['hr.holiday.inquiry'].search([('employee_id', '=', record.employee_id.id), ('company_id', '=', record.company_id.id), ('holiday_type_id', '=', paid_leave_type.id), ('is_current_period', '=', True)])
      month = datetime.datetime.now().month
      balance = sum(inquirys.mapped('balances'))
      dif = 0
      for i in range(int(record.start_date[5:7]),month):
      dif += 0.5
      res = 0
      for i in range(int(record.end_date[5:7]),month):
      res += 0.5
      if (int(record.start_date[5:7]) >= month) and (balance > dif) or (int(record.start_date[5:7]) <= int(record.end_date[5:7]) < month) and (balance > res) or (int(record.start_date[5:7]) < month <= int(record.end_date[5:7])) and balance > res:
      raise ValidationError('根据休假规则您尚有带薪病假可用余额,请优先申请。')
      elif record.holiday_type_id.code == 'L017' and ((record.start_date and record.employee_id.birthday and record.start_date[5:7] != record.employee_id.birthday[5:7]) or not record.employee_id.birthday):
      raise ValidationError('根据公司政策,你的休假日期不满足生日假申请条件。')

      显示
      result = True if record.holiday_type_id.code == 'L019' and record.employee_id.departure_time: raise ValidationError('根据公司政策,已提离职不能申请带薪病假。') elif record.holiday_type_id.code == 'L007' and not record.employee_id.departure_time: if record.start_date >= record.employee_id.hiredate + relativedelta.relativedelta(months=3): paid_leave_type = env ['hr.holiday.type'] .search( [('code', '=', 'L019')] , limit=1) inquirys = env ['hr.holiday.inquiry'] .search( [('employee_id', '=', record.employee_id.id), ('company_id', '=', record.company_id.id), ('holiday_type_id', '=', paid_leave_type.id), ('is_current_period', '=', True)] ) month = datetime.datetime.now().month balance = sum(inquirys.mapped('balances')) dif = 0 for i in range(int(record.start_date [5:7] ),month): dif += 0.5 res = 0 for i in range(int(record.end_date [5:7] ),month): res += 0.5 if (int(record.start_date [5:7] ) >= month) and (balance > dif) or (int(record.start_date [5:7] ) <= int(record.end_date [5:7] ) < month) and (balance > res) or (int(record.start_date [5:7] ) < month <= int(record.end_date [5:7] )) and balance > res: raise ValidationError('根据休假规则您尚有带薪病假可用余额,请优先申请。') elif record.holiday_type_id.code == 'L017' and ((record.start_date and record.employee_id.birthday and record.start_date [5:7] != record.employee_id.birthday [5:7] ) or not record.employee_id.birthday): raise ValidationError('根据公司政策,你的休假日期不满足生日假申请条件。')

      原逻辑:扣薪病假时判断,如果有带薪病假余额时,提示优先申请带薪病假。
      修改背景:带薪病假禁用3个月
      现逻辑:扣薪病假判断时,增加员工入职超过3个月,如果有带薪病假余额时,提示优先申请带薪病假。

            wenqiang.liu 刘文强
            zhongshm 钟时敏
            表决:
            0 为这个问题表决

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