Merge pull request !5050 from 李鹏宇/dev
This commit is contained in:
李鹏宇
2025-09-10 09:23:50 +00:00
committed by Gitee
@@ -147,7 +147,15 @@ 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
if month_start > entry_date:
start_day = 1
else:
days_in_month = (date(year, month + 1, 1) - timedelta(days=1)).day
start_day = min(entry_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),