result = True start_date = datetime.datetime.strptime(record.employee_id.departure_time,'%Y-%m-%d') if record.employee_id.departure_time else None end_date = datetime.datetime.strptime(record.hire_date,'%Y-%m-%d') if record.hire_date else None if not record.x_sfbfxz: if start_date: start_date_year = start_date.year start_date_month = start_date.month end_date_year = end_date.year end_date_month = end_date.month start_date_month1 = (start_date+relativedelta.relativedelta(months=1)).month start_date_year1 = (start_date+relativedelta.relativedelta(years=1)).year if (start_date_year == end_date_year and (start_date_month == end_date_month or start_date_month1 == end_date_month)) or (start_date_month == 12 and start_date_year1 == end_date_year and start_date_month1 == end_date_month): raise ValidationError('请备份该员工薪资数据后再入职,谢谢!')
设置强提示,即在重新雇佣界面加一个字段:是否已备份薪资数据 判断员工主数据中离职日期与当前单据上创建的入职日期,如果员工离职不满2个月,则提示“请备份该员工薪资数据后再入职,谢谢!”,HR修改字段是否已备份薪资数据 为“是”,则提示关闭,可提交成功