Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion addons/hr/views/hr_employee_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@
<span invisible="not contract_date_start">to</span>
<field name="contract_date_end" string="End Date" placeholder="Indefinite" widget="date_dynamic_min" options="{'min_date_field': 'contract_date_start'}"
class="o_hr_narrow_field ms-3" invisible="not contract_date_start"/>
<widget name="button_new_contract"/>
<widget name="button_new_contract" invisible="not contract_date_start"/>
</div>
<field name="fixed_term" string="Fixed Term" invisible="1"/>
<label for="wage"/>
Expand Down
2 changes: 1 addition & 1 deletion addons/hr_holidays/models/hr_work_entry_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def _search_max_leaves(self, operator, value):

def _search_virtual_remaining_leaves(self, operator, value):
def is_valid(work_entry_type):
return not work_entry_type.requires_allocation or op(work_entry_type.virtual_remaining_leaves)
return not work_entry_type.requires_allocation or op(work_entry_type.virtual_remaining_leaves, value)
op = PY_OPERATORS.get(operator)
if not op:
return NotImplemented
Expand Down
17 changes: 17 additions & 0 deletions addons/hr_holidays/tests/test_hr_work_entry_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,3 +232,20 @@ def test_change_count_days_as(self):

with self.assertRaises(ValidationError):
work_entry_type.count_days_as = 'working'

def test_search_virtual_remaining_leaves(self):
"""
Test searching on the computed field 'virtual_remaining_leaves'
does not throw a TypeError missing the 'value' argument.
"""
employee = self.env['hr.employee'].create({'name': 'Test Employee'})
result = self.env["hr.work.entry.type"].with_context(employee_id=employee.id).search(
[
("virtual_remaining_leaves", ">", 0),
],
)

self.assertTrue(
isinstance(result, type(self.env["hr.work.entry.type"])),
"The search should return a valid recordset without crashing.",
)