diff --git a/yuthon_holiday/models/inherit_hr_leave.py b/yuthon_holiday/models/inherit_hr_leave.py index 0c8848d4d..34115d5de 100644 --- a/yuthon_holiday/models/inherit_hr_leave.py +++ b/yuthon_holiday/models/inherit_hr_leave.py @@ -934,15 +934,15 @@ class HolidaysRequestBatch(models.Model): continue match = re.search(r'(\d+(?:\.\d+)?)', line.number_of_hours_text or '') if not match: - raise ValidationError( + raise UserError( _(f"第{line.sequence or '一'}条小时请假记录:无法提取有效小时数!")) daily_hours = float(match.group(1)) if daily_hours == 0.0: - raise ValidationError( + raise UserError( _(f"第{line.sequence or '一'}条小时请假记录:请假小时数不能为0!")) if daily_hours not in VALID_DAILY_HOURS: - raise ValidationError( + raise UserError( _(f"第{line.sequence or '一'}条小时请假记录:休假时长必须为 2、4、6 或 8 小时才可以保存!") ) leave_days = 0.0