diff --git a/yuthon_holiday/models/inherit_hr_leave.py b/yuthon_holiday/models/inherit_hr_leave.py index 1038372e1..67ccb5686 100644 --- a/yuthon_holiday/models/inherit_hr_leave.py +++ b/yuthon_holiday/models/inherit_hr_leave.py @@ -984,6 +984,29 @@ class HolidaysRequestBatch(models.Model): _(f"天河物管休假时长必须为 2、4、6 或 8 小时才可以保存!") ) + if record.hour_leave_ids and record.company_id.name == '集团本部': + for line in record.hour_leave_ids: + if not line.request_date_from or not line.request_hour_to: + continue + match = re.search(r'(\d+(?:\.\d+)?)', line.number_of_hours_text or '') + if not match: + raise UserError( + _("无法提取有效小时数!")) + daily_hours = float(match.group(1)) + if daily_hours == 0.0: + raise UserError( + _("请假小时数不能为0!")) + + # ===================== 核心修改 ===================== + # 校验是否为 1 的倍数(整数小时) + if not daily_hours.is_integer(): + raise UserError( + _("集团本部休假时长必须为 1 的整数倍才可以保存!") + ) + # ==================================================== + + + total_annual_leave_days = 0.0 # 年假总天数 total_compensatory_leave_days = 0.0 # 补休总天数 for leave_line in record.leave_ids: diff --git a/yuthon_holiday/views/hr_leave_batch.xml b/yuthon_holiday/views/hr_leave_batch.xml index 36680c7bd..e182ec441 100644 --- a/yuthon_holiday/views/hr_leave_batch.xml +++ b/yuthon_holiday/views/hr_leave_batch.xml @@ -68,11 +68,13 @@ - - + + - - + + @@ -178,8 +180,9 @@ - - + + yuthon.medical.manage.tree yuthon.medical.manage - +