Merge pull request !12497 from 李鹏宇/dev
This commit is contained in:
李鹏宇
2026-07-27 02:39:04 +00:00
committed by Gitee
+5 -4
View File
@@ -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