Files
odoo_source/addons/hr_work_entry_holidays
Thomas Lefebvre (thle) f24f2d6384 [FIX] hr_work_entry_holidays: ensure the consistency of leaves
Steps to reproduce:
-------------------
- install `hr_work_entry_holidays` module
- create an employee and add two contracts:
    - from 2023-01-01 to 2023-06-30 with a full time (5/5) resource
      which is expired
    - from 2023-07-01 to 2023-12-31 with a partial time (4/5) resource
      which is running
      (doesn't work on Wednesday)
- create an allocation with 10 days
- with the employee, create two leaves:
    - 3 days during the first semester with one Wednesday
    - 3 days during the second semester with one Wednesday

Issue:
------
Leave duration is based on the current contract.
If we change the type of leave by modifying its days/hours unit,
we will get inconsistencies between days and hours for leave taken
in a period belonging to another contract.

Cause:
------
Expired contracts are not taken into account
when calculating the number of days and hours.

Solution:
---------
Add `close` state to contract search.

opw-3419380

closes odoo/odoo#132144

X-original-commit: 249f8c836f606c0dfc5f3b6e64ad9b319b5a4602
Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
Signed-off-by: Thomas Lefebvre (thle) <thle@odoo.com>
2023-08-21 07:19:51 +02:00
..