!8625 添加功能

Merge pull request !8625 from 李鹏宇/dev_zhou
This commit is contained in:
李鹏宇
2026-02-04 02:12:47 +00:00
committed by Gitee
@@ -637,7 +637,10 @@ class YuthonVacationReports(models.Model):
month_start = date(year, month, 1)
month_end = date(year, month, calendar.monthrange(year, month)[1])
# 计算start_date:外派且无合同时用month_start,否则取合同开始日与month_start的最大值
start_date = month_start if (is_outside and not contract) else max(contract.date_start, month_start)
if contract.date_start:
start_date = month_start if (is_outside and not contract) else max(contract.date_start, month_start)
else:
start_date = month_start
# 计算end_date:外派且无合同时用month_end;有合同且有结束日则取最小值;其他情况用month_end
end_date = month_end if (is_outside and not contract) else (min(contract.date_end, month_end) if contract.date_end else month_end)
leave_days, statutory_days = rec._create_leave_record(rec.employee_id, start_date, end_date)