From a8b0b01605d9f880aa5203209c57c524a6a300f4 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 Apr 2026 11:44:57 +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/yuthon_vacation_reports.py | 19 +++++++++++++++++-- .../static/src/js/button_vacation_put.js | 5 +++++ .../static/src/xml/button_vacation_put.xml | 5 +++++ 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/yuthon_hr_attendance/models/yuthon_vacation_reports.py b/yuthon_hr_attendance/models/yuthon_vacation_reports.py index d36e15f60..8d3ef05ed 100644 --- a/yuthon_hr_attendance/models/yuthon_vacation_reports.py +++ b/yuthon_hr_attendance/models/yuthon_vacation_reports.py @@ -191,7 +191,6 @@ class YuthonVacationReports(models.Model): 'duty_date': duty_date, 'is_adjustment': False }) - # 批量创建(效率更高) if create_vals: duty_schedule_env.create(create_vals) record.duty_ids = duty_schedule_env.search([ @@ -200,7 +199,6 @@ class YuthonVacationReports(models.Model): ('duty_date', '<=', month_end) ]) - @api.depends('duty_ids.is_adjustment') def _compute_duty_fee(self): for record in self: @@ -1246,6 +1244,23 @@ class YuthonVacationReports(models.Model): day = day.lstrip('0') return f'{month}月{day}日' + @api.model + def put_vacation(self): + today = fields.Date.today() + first_day = today.replace(day=1) + last_month_first = first_day - relativedelta(months=1) + report_objs = self.env['yuthon.vacation.reports'].search([ + ('vacation_date', '=', last_month_first), + ('vacation_state', '=', 'not_sent'), + ]) + for report in report_objs: + resource_user_ids = report.employee_id.resource_calendar_id.resource_user_ids.ids + if report.employee_id.id in resource_user_ids: + report.write({'vacation_state': 'confirmed'}) + else: + report.button_put() + + def att_button_put_task(self): today = fields.Date.today() first_day = today.replace(day=1) diff --git a/yuthon_hr_attendance/static/src/js/button_vacation_put.js b/yuthon_hr_attendance/static/src/js/button_vacation_put.js index a4fb129a1..418ee9608 100644 --- a/yuthon_hr_attendance/static/src/js/button_vacation_put.js +++ b/yuthon_hr_attendance/static/src/js/button_vacation_put.js @@ -22,6 +22,11 @@ export class CustomAttendanceVacationPutController extends ListController { const res = await this.orm.call('yuthon.vacation.reports', 'meal_line', []); this.actionService.doAction(res) } + + async getPutAction() { + const res = await this.orm.call('yuthon.vacation.reports', 'put_vacation', []); + this.actionService.doAction(res) + } } registry.category("views").add("custom_vacation_put_button", { diff --git a/yuthon_hr_attendance/static/src/xml/button_vacation_put.xml b/yuthon_hr_attendance/static/src/xml/button_vacation_put.xml index 8dc2e1203..bd03b5759 100644 --- a/yuthon_hr_attendance/static/src/xml/button_vacation_put.xml +++ b/yuthon_hr_attendance/static/src/xml/button_vacation_put.xml @@ -16,5 +16,10 @@ 误餐情况 + + +