[FIX]hr_negative_leave:fix leave types available when creating a leave request #17
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
"name": "hr_negative_leave",
|
"name": "hr_negative_leave",
|
||||||
"version": "16.0.3.0.0",
|
"version": "16.0.3.0.1",
|
||||||
"author": "Elabore",
|
"author": "Elabore",
|
||||||
"website": "https://elabore.coop",
|
"website": "https://elabore.coop",
|
||||||
"maintainer": "Elabore",
|
"maintainer": "Elabore",
|
||||||
|
|||||||
@@ -5,17 +5,26 @@
|
|||||||
<field name="inherit_id" ref="hr_holidays.hr_leave_view_form" />
|
<field name="inherit_id" ref="hr_holidays.hr_leave_view_form" />
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//field[@name='holiday_status_id']" position="attributes">
|
<xpath expr="//field[@name='holiday_status_id']" position="attributes">
|
||||||
|
<!-- Pseudo-code for the domain:
|
||||||
|
if requires_allocation == 'no':
|
||||||
|
mondot marked this conversation as resolved
Outdated
|
|||||||
|
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">[
|
<attribute name="domain">[
|
||||||
'|',
|
'|', '|',
|
||||||
('requires_allocation', '=', 'no'),
|
('requires_allocation', '=', 'no'),
|
||||||
'&',
|
'&',
|
||||||
('has_valid_allocation', '=', True),
|
('has_valid_allocation', '=', True),
|
||||||
'|',
|
'&',
|
||||||
('allows_negative', '=', True),
|
('virtual_remaining_leaves', '>', 0),
|
||||||
'&',
|
('max_leaves', '>', 0),
|
||||||
('virtual_remaining_leaves', '>', 0),
|
('allows_negative', '=', True)
|
||||||
('allows_negative', '=', False),
|
]</attribute>
|
||||||
]</attribute>
|
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|||||||
Reference in New Issue
Block a user
Je trouve les effets de bord de ce domaine assez compliqué à identifier, du coup j'ai demandé à notre ami Claude.
Est-ce que tu es d'accord avec sa suggestion ? (moi je suis plutôt d'accord)
hello,
pour allows_negative, c'est voulu, on veut pouvoir sélectionner le type de congé même en cas de solde négatif
pour has_valid_allocation, c'est en effet trop permissif, j'ai repris le domain initial qui est :
if requires_allocation == 'no':
ok
elif has_valid_allocation and virtual_remaining_leaves > 0 and max_leaves > 0:
ok
else:
refuse
que j'ai changé pour
if requires_allocation == 'no': ok
elif has_valid_allocation and virtual_remaining_leaves > 0 and max_leaves > 0: ok
elif allow_negative == True: ok
else: refuse
Top, et merci pour le pseudo code en commentaire 😍