From dcda68e5806d8f9095549a2ee7baa8b80df93aa4 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: Thu, 16 Apr 2026 10:37:21 +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 --- .../models/vacation_overtime_active.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/yuthon_hr_attendance/models/vacation_overtime_active.py b/yuthon_hr_attendance/models/vacation_overtime_active.py index 25998e64d..625067245 100644 --- a/yuthon_hr_attendance/models/vacation_overtime_active.py +++ b/yuthon_hr_attendance/models/vacation_overtime_active.py @@ -190,12 +190,9 @@ class VacationOvertimeActive(models.Model): ('carryover_type', '=', 'leave'), ('leave_id.start_date', '>', last_day), ] - - # 1. 先查询,计算总和 records = self.env['overtime.carryover'].search(original_domain) total = sum(r.carry_forward_quantity for r in records) - - if math.isclose(total, self.carry_forward_quantity, abs_tol=1e-9): + if math.isclose(total, self.carry_forward_quantity, abs_tol=0.1): final_domain = original_domain else: final_domain = [ @@ -216,3 +213,15 @@ class VacationOvertimeActive(models.Model): 'domain': final_domain, 'target': 'current', } + + # 打开视图 + view_id = self.env.ref('yuthon_hr_attendance.view_overtime_carryover_tree1').id + return { + 'name': f'加班明细', + 'type': 'ir.actions.act_window', + 'res_model': 'overtime.carryover', + 'view_mode': 'tree', + 'view_id': view_id, + 'domain': final_domain, + 'target': 'current', + }