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