Skip to content

Commit c44c21b

Browse files
[FIX] hr_holidays: fix time off type error in time off form view
1. Go to **Time Off > Configuration > Time Off Types**. 2. Open a type and click the "Time Off" smart button. 3. Click **New**. 4. An error appears. [[Reference Video](https://drive.google.com/file/d/1vi_apL24Km5tSomQtwcTArqqWvrBR5ni/view)] In the `_search_virtual_remaining_leaves` method, the code tries to use an operator (like `>`) to compare the `virtual_remaining_leaves`. This operator requires **two** arguments to work. However, the code was only passing **one** argument, missing the `value` to compare against. This caused the "expects 2 arguments" error. Passed the missing `value` to the operator call so the comparison can be completed correctly. Task: 5241685
1 parent af46c2a commit c44c21b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-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
@@ -280,7 +280,7 @@ def _search_virtual_remaining_leaves(self, operator, value):
280280
leave_types = self.env['hr.leave.type'].search([])
281281

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

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

0 commit comments

Comments
 (0)