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