16.0-negative-leaves-and-allocation #13
Reference in New Issue
Block a user
No description provided.
Delete Branch "16.0-negative-leaves-and-allocation"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
lié à la tache https://elabore.coop/web#id=5573&menu_id=198&cids=1&action=317&active_id=122&model=project.task&view_type=form
Coverage de 78% pour
hr_leave_type.py, c'est plutôt cool :)Je te mets des captures d'écran pour voir les parties non couvertes :
Ce qui est rassurant c'est que les tests de
hr_holidayspassent :)@@ -0,0 +24,4 @@for holiday_type in self:if holiday_type.allows_negative:# if left != usable : remaining_leaves_allowing_negative = left + usableif holiday_type.virtual_remaining_leaves < 0 (holiday_type.max_leaves - holiday_type.virtual_leaves_taken) != holiday_type.virtual_remaining_leaves:Tu peux ajouter des tests pour ce compute please ?
On se serait vite rendu compte qu'il manque qqch dans la formulation
if holiday_type.virtual_remaining_leaves < 0 (holiday_type.max_leaves - holiday_type.virtual_leaves_taken) != holiday_type.virtual_remaining_leaves:(à priori un
and?)Vu ensemble, remaining_leaves_allowing_negative à supprimer.
c'est un reliquat de code qui n'est plus utilisé nulle part et que j'ai oublié de supprimer, c'est maintenant fait
@@ -0,0 +37,4 @@res = super()._compute_valid()for holiday_type in res:if not holiday_type.has_valid_allocation:holiday_type.has_valid_allocation = holiday_type.allows_negativeen faisant ça tu mets sous le tapis toute cette condition
qu'on retrouve dans le
_compute_valid(), non ?Vu ensemble : mettre un petit commentaire qui explique que has_valid_allocation n'a plus de sens si on accepte les congés négatifs
vu en visio avec @mondot , j'ai ajouté un commentaire pour expliquer le code
@@ -0,0 +40,4 @@holiday_type.has_valid_allocation = holiday_type.allows_negative#overwrite _get_employees_days_per_allocation() from hr_holidays moduledef _get_employees_days_per_allocation(self, employee_ids, date=None):J'ai du mal à comprendre cette maxi fonction. Je veux bien qu'on voit ça ensemble.
@@ -0,0 +165,4 @@# if negative is not allowed for this leave type, then we cannot exceed the allocation amount# the max leaves for this allocation is the minimum between the remaining available days and the leave durationmax_leaves = min(virtual_remaining_leaves, leave_duration)# the new calculation of days taken for this allocation is previous taken + max_leaves (which can never exceed the allocation total)ok
@@ -0,0 +39,4 @@if not holiday_type.has_valid_allocation:holiday_type.has_valid_allocation = holiday_type.allows_negative#overwrite _get_employees_days_per_allocation() from hr_holidays moduleon pourrait ajouter
# Check for 'Modification for leaves allowing negative' to see the modifications