From 3f43a00761f01db1d11128d6283e2290c0291d93 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: Fri, 5 Sep 2025 18:27:23 +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/inherit_hr_leave_allocation.py | 11 +++-------- .../views/inherit_hr_leave_allocation_views.xml | 4 ++-- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/yuthon_holiday/models/inherit_hr_leave_allocation.py b/yuthon_holiday/models/inherit_hr_leave_allocation.py index fb307668e..d84f2215b 100644 --- a/yuthon_holiday/models/inherit_hr_leave_allocation.py +++ b/yuthon_holiday/models/inherit_hr_leave_allocation.py @@ -101,10 +101,12 @@ class HrLeaveAllocation(models.Model): } def update_employee(self): + date = datetime(2025, 1, 1) leave_ids = self.env["hr.leave.allocation"].browse( self._context.get('active_ids', self._context.get('active_id'))) for leave in leave_ids: - leave.employee_id.write({'quota_issued': leave.number_of_hours_display}) + if leave.holiday_status_id.name == '年假': + leave.date_from = date # @api.model # def create(self, vals): @@ -208,13 +210,6 @@ class HrLeaveAllocation(models.Model): if reports_id: reports_id.write({'leave_ids': leave_list}) reports_id.write({'overtime_ids': compensatory_list}) - else: - reports_id = self.env['yuthon.vacation.reports'].create({ - 'employee_id': leave.employee_id.id, - 'vacation_date': date - }) - reports_id.write({'leave_ids': leave_list}) - reports_id.write({'overtime_ids': compensatory_list}) # def allocation_date(self): # date = datetime(2025, 1, 1) diff --git a/yuthon_holiday/views/inherit_hr_leave_allocation_views.xml b/yuthon_holiday/views/inherit_hr_leave_allocation_views.xml index 4983aa643..0fe64af71 100644 --- a/yuthon_holiday/views/inherit_hr_leave_allocation_views.xml +++ b/yuthon_holiday/views/inherit_hr_leave_allocation_views.xml @@ -55,7 +55,7 @@ code action = model.all_refuse() - + 批量批准 @@ -77,7 +77,7 @@ action = model.update_vacation() - 一次性更新 + 更新分配时间 code