!5048 添加功能

Merge pull request !5048 from 李鹏宇/dev_zhou
This commit is contained in:
李鹏宇
2025-09-10 09:20:01 +00:00
committed by Gitee
@@ -147,7 +147,16 @@ class YuthonVacationReports(models.Model):
month_start = date(year, month, 1)
month_end = date(year, month, days_in_month)
leave_days = rec._create_leave_record(rec.employee_id, month_start, month_end)
for day in range(1, days_in_month + 1):
entry_date = rec.employee_id.entry_date
actual_start_date = max(month_start, entry_date) if entry_date else month_start
if not entry_date:
start_day = 1
else:
days_in_month = (date(year, month + 1, 1) - timedelta(days=1)).day
start_day = min(actual_start_date.day, days_in_month)
days_in_month = (date(year, month + 1, 1) - timedelta(days=1)).day
actual_days_range = range(start_day, days_in_month + 1)
for day in actual_days_range:
current_date = date(year, month, day)
attendances = self.env["hr.attendance"].sudo().search([
('employee_id', '=', rec.employee_id.id),