代码:
result = True
start_date = datetime.datetime.strptime(record.start_date,'%Y-%m-%d')
hire_date = datetime.datetime.strptime(record.employee_id.hiredate,'%Y-%m-%d')
if record.holiday_type_id.code in ['HK01','HK09','L006']:
if hire_date and start_date:
if (start_date-start_date).days<280:
raise ValidationError('入职未满40周!')
代码:
result = True
start_date = datetime.datetime.strptime(record.start_date,'%Y-%m-%d')
hire_date = datetime.datetime.strptime(record.employee_id.hiredate,'%Y-%m-%d')
if record.holiday_type_id.code in ['HK01','HK09','L006'] :
if hire_date and start_date:
if (start_date-start_date).days<280:
raise ValidationError('入职未满40周!')