From a53f62a071f7b3aeae4a65df4df4f71137aed5cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= Date: Mon, 27 Jul 2026 10:37:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=81=87=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yuthon_holiday/models/inherit_hr_leave.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/yuthon_holiday/models/inherit_hr_leave.py b/yuthon_holiday/models/inherit_hr_leave.py index 8951524db..42635c8a4 100644 --- a/yuthon_holiday/models/inherit_hr_leave.py +++ b/yuthon_holiday/models/inherit_hr_leave.py @@ -1235,19 +1235,20 @@ class HolidaysRequestBatch(models.Model): parental_leave_type = self.env['hr.leave.type'].search([('name', 'ilike', '育儿假')], limit=1) if parental_leave_type: allocation_records = self.env['hr.leave.allocation'].search([ - ('employee_id', '=', parental_leave_type.id), + ('employee_id', '=', employee.id), + ('holiday_status_id', '=', parental_leave_type.id), ('state', 'in', ['validate', 'done']), ('date_from', '<=', current_date), '|', ('date_to', '=', False), ('date_to', '>=', current_date) - ]) + ],limit=1) total_allocation = sum( alloc.number_of_days_display for alloc in allocation_records) if allocation_records else 0.0 used_parental_leave_list = self.env['hr.leave'].search([ ('employee_id', '=', employee.id), ('holiday_status_id', '=', parental_leave_type.id), ('state', 'in', ['validate', 'done']), - ('date_from', '<=', current_date), - ('date_to', '>=', current_date) + ('date_from', '>=', allocation_records.date_from), + ('date_to', '<=', allocation_records.date_to) ]) used_days = sum(leave.number_of_days_display for leave in used_parental_leave_list) if used_parental_leave_list else 0.0