From 4325ae471c72e842cbb871c4c456e4da064ea3c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= <9664676+pengyuthon@user.noreply.gitee.com> Date: Wed, 8 Jul 2026 10:44:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yuthon_hr_attendance/models/yuthon_vacation_reports.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/yuthon_hr_attendance/models/yuthon_vacation_reports.py b/yuthon_hr_attendance/models/yuthon_vacation_reports.py index d29603786..47e01c600 100644 --- a/yuthon_hr_attendance/models/yuthon_vacation_reports.py +++ b/yuthon_hr_attendance/models/yuthon_vacation_reports.py @@ -3341,10 +3341,15 @@ class VacationMealLine(models.Model): def confirm(self): valid_leaves = self.env['vacation.meal.line'].browse( self._context.get('active_ids', self._context.get('active_id'))) + # 检查确认日期,没有则提示未确认 + for rec in valid_leaves: + if not rec.confirm_date: + raise UserError("未确认,请勿归档") + emp_month_summary = {} for rec in valid_leaves: - rec_year = rec.start_time.year - rec_month = rec.start_time.month + rec_year = rec.confirm_date.year + rec_month = rec.confirm_date.month rec.write({'is_filing': True}) emp_id = rec.employee_id.id active_exists = self.env['vacation.meal.active'].search([ @@ -3375,7 +3380,6 @@ class VacationMealLine(models.Model): emp_month_summary[summary_key] = 0.0 emp_month_summary[summary_key] += rec.update_lines or 0.0 - # 4. 第二步:遍历汇总结果,为每个【员工+年月】创建一条vacation.over.line for (emp_id, rec_year, rec_month), total_amount in emp_month_summary.items(): if total_amount <= 1e-6: continue