From aa2e5c5f9d0104cfe6b2c59951c5db06872a5242 Mon Sep 17 00:00:00 2001 From: zhou <123@> Date: Wed, 16 Jul 2025 18:45: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_holiday/models/yuthon_vacation_reports.py | 7 +++++++ yuthon_holiday/views/yuthon_vacation_reports_views.xml | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/yuthon_holiday/models/yuthon_vacation_reports.py b/yuthon_holiday/models/yuthon_vacation_reports.py index ff9861efe..1460b55fc 100644 --- a/yuthon_holiday/models/yuthon_vacation_reports.py +++ b/yuthon_holiday/models/yuthon_vacation_reports.py @@ -18,6 +18,13 @@ class YuthonVacationReports(models.Model): working_overtime = fields.Float(string='加班时', compute='_compute_working_overtime', store=True) meal_fee = fields.Integer(string="误餐次数", compute='_compute_meal_fee', store=True) + def update_vac(self): + vacation_ids = self.env["yuthon.vacation.reports"].browse( + self._context.get('active_ids', self._context.get('active_id'))) + for record in vacation_ids: + penultimate_record = record.overtime_ids[-2] + penultimate_record.unlink() + def vacation_delete(self): vacation_ids = self.env["yuthon.vacation.reports"].browse( self._context.get('active_ids', self._context.get('active_id'))) diff --git a/yuthon_holiday/views/yuthon_vacation_reports_views.xml b/yuthon_holiday/views/yuthon_vacation_reports_views.xml index 983d51b12..c635d1bd9 100644 --- a/yuthon_holiday/views/yuthon_vacation_reports_views.xml +++ b/yuthon_holiday/views/yuthon_vacation_reports_views.xml @@ -109,6 +109,13 @@ code action = model.vacation_delete() + + 一次性 + + + code + action = model.update_vac() + details.tree.tree details.tree