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', + }