[FIX]hr_negative_leave:fix leave types available when creating a leave request
Some checks failed
pre-commit / pre-commit (pull_request) Failing after 1m33s

This commit is contained in:
2026-02-10 14:41:28 +01:00
parent 9e4342fba2
commit 821b17fbd5
2 changed files with 18 additions and 9 deletions

View File

@@ -5,17 +5,26 @@
<field name="inherit_id" ref="hr_holidays.hr_leave_view_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='holiday_status_id']" position="attributes">
<!-- Pseudo-code for the domain:
if requires_allocation == 'no':
ok
elif has_valid_allocation and virtual_remaining_leaves > 0 and max_leaves > 0:
ok
elif allows_negative == True:
ok
else:
refuse
-->
<attribute name="domain">[
'|',
'|', '|',
('requires_allocation', '=', 'no'),
'&amp;',
('has_valid_allocation', '=', True),
'|',
('allows_negative', '=', True),
'&amp;',
('virtual_remaining_leaves', '&gt;', 0),
('allows_negative', '=', False),
]</attribute>
('has_valid_allocation', '=', True),
'&amp;',
('virtual_remaining_leaves', '&gt;', 0),
('max_leaves', '&gt;', 0),
('allows_negative', '=', True)
]</attribute>
</xpath>
</field>
</record>