Skip to content

Commit a9f8d87

Browse files
abdullahsherifMahmoudk3m
authored andcommitted
[FIX] hr_holidays: Traceback on Time Off Type
Bug: traceback error when going throw normal flows Cause: missing parameter on a function call Fix: added the missing parameter Steps to reproduce: Time Off >> Configuration >> Time Off Types >> Open any type, navigate to the Smart button Time Off >> Click on New >> Time Off Type Task #5379901
1 parent e89ff9d commit a9f8d87

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

addons/hr_holidays/models/hr_leave_type.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ def _search_virtual_remaining_leaves(self, operator, value):
283283
leave_types = self.env['hr.leave.type'].search([])
284284

285285
def is_valid(leave_type):
286-
return not leave_type.requires_allocation or op(leave_type.virtual_remaining_leaves)
286+
return not leave_type.requires_allocation or op(leave_type.virtual_remaining_leaves, value)
287287
return [('id', 'in', leave_types.filtered(is_valid).ids)]
288288

289289
@api.depends_context('employee_id', 'default_employee_id', 'leave_date_from', 'default_date_from')

addons/hr_holidays/tests/test_hr_leave_type.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,12 @@ def test_users_tz_shift_back(self):
114114
).search([('has_valid_allocation', '=', True)], limit=1)
115115

116116
self.assertFalse(leave_types, "Got valid leaves outside vaild period")
117+
118+
def test_search_virtual_remaining_leaves(self):
119+
self.env['hr.leave.type'].create({
120+
'name': 'virtual_remaining_leaves_testing_type',
121+
'time_type': 'leave',
122+
'requires_allocation': True,
123+
})
124+
125+
self.assertIn('virtual_remaining_leaves_testing_type', self.env['hr.leave.type'].search(domain=[('virtual_remaining_leaves', '>', -1)]).mapped('name'))

0 commit comments

Comments
 (0)