diff --git a/yuthon_holiday/models/inherit_hr_leave_allocation.py b/yuthon_holiday/models/inherit_hr_leave_allocation.py index 9eb6832d3..53f25985d 100644 --- a/yuthon_holiday/models/inherit_hr_leave_allocation.py +++ b/yuthon_holiday/models/inherit_hr_leave_allocation.py @@ -223,9 +223,12 @@ class HrLeaveAllocation(models.Model): 'vacation_date': date }) - reports_id.write({'leave_ids': [(5, 0, 0)] + leave_list}) - reports_id.write({'overtime_ids': [(5, 0, 0)] + compensatory_list}) - reports_id.write({'other_fee_ids': [(5, 0, 0)] + other_list}) + if leave_list: + reports_id.write({'leave_ids': [(5, 0, 0)] + leave_list}) + if compensatory_list: + reports_id.write({'overtime_ids': [(5, 0, 0)] + compensatory_list}) + if other_list: + reports_id.write({'other_fee_ids': [(5, 0, 0)] + other_list}) # def allocation_date(self): # date = datetime(2025, 1, 1) # leave_id = self.env['hr.leave.allocation'].search([])