添加功能

This commit is contained in:
李鹏宇
2026-07-24 11:05:03 +08:00
parent 7ac97491ae
commit 5c60764f05
@@ -2660,7 +2660,7 @@ class YuthonVacationReports(models.Model):
today = date.today()
last_month_first = (today - relativedelta(months=1)).replace(day=1) # 上月1号
current_month_first = today.replace(day=1) # 本月1号
current_month_first_dt = datetime.combine(current_month_first, datetime.min.time())
current_month_first_dt = datetime.combine(current_month_first + relativedelta(months=1) - timedelta(days=1), datetime.min.time())
dec_2025_end = datetime(2025, 12, 31, 23, 59, 59)
# 3. 仅处理集团本部的数据
@@ -2681,15 +2681,15 @@ class YuthonVacationReports(models.Model):
employee_summary = {}
for line in all_records:
line.select_month = str(last_month_first.month)
line.select_year = str(last_month_first.year)
line.select_month = str(current_month_first.month)
line.select_year = str(current_month_first.year)
emp_id = line.employee_id.id
if not emp_id:
continue
if emp_id not in employee_summary:
report_id = self.env['yuthon.vacation.reports'].search(
[
('vacation_date', '=', last_month_first),
('vacation_date', '=', current_month_first),
('employee_id', '=', emp_id),
],
limit=1 # 避免多条记录,只取第一条
@@ -2697,8 +2697,8 @@ class YuthonVacationReports(models.Model):
vacation_sum = report_id.dynamic_previous_year1 * 8 + report_id.this_year1 * 8 if report_id else 0.0
active_id = self.env['vacation.overtime.active'].search(
[('employee_id', '=', emp_id),
('select_month', '=', str(last_month_first.month)),
('select_year', '=', str(last_month_first.year)),
('select_month', '=', str(current_month_first.month)),
('select_year', '=', str(current_month_first.year)),
('select_revoke', '!=', 'done'),
])
if active_id: