Skip to content

Conversation

fw-bot
Copy link
Contributor

@fw-bot fw-bot commented Jan 28, 2025

Steps

  • create an accrual plan with a level giving 1 hour every month and a carry
    over with a maximum of 4 hours. Set accrued gain time at the start of the period
    and carry-over time at start of the year.
  • create an allocation using this accrual plan, for a time off type in days,
    set the start date on the first day of next year.
  • go to Time Off Dashboard
  • check the balance on the middle of the month of the following year (e.g.
    15 january 2026 if the allocation starts on 1 january 2025).

-> ~14 days of time off available: the max postpone amount is not applied,
the time gained is in days and not in hours and more than 1 day is gained/month
(balance a few days after the start of the allocation should be +1 added_value
but is more than that).

Causes:

  • the maximum amount of carry over postpone_max_days is applied in days
    even if the accrual added_value is in hours and the UI shows postpone_max_days
    as "Up to X hours".
  • get_future_leaves returns a number of hours if the allocation is in hours, even
    if the time off type is in days.
  • the number of hours from the accrual at the beginning of the allocation is too
    high if the start of the accrual is in the future and gain time added at the start
    of the period due to cache not being invalidated.
    if self.type_request_unit in ['hour']:
    return float_round(fake_allocation.number_of_hours_display - self.number_of_hours_display, precision_digits=2)
    res = round((fake_allocation.number_of_days - self.number_of_days), 2)
    fake_allocation._invalidate_cache(['number_of_days', 'number_of_days_display', 'lastcall', 'nextcall', 'number_of_hours_display'])

opw-4272315

Forward-Port-Of: #195361
Forward-Port-Of: #185699

Steps
- create an accrual plan with a level giving 1 hour every month and a carry
over with a maximum of 4 hours. Set accrued gain time at the start of the period
and carry-over time at start of the year.
- create an allocation using this accrual plan, for a time off type in days,
set the start date on the first day of next year.
- go to Time Off Dashboard
- check the balance on the middle of the month of the following year (e.g.
15 january 2026 if the allocation starts on 1 january 2025).

-> ~14 days of time off available: the max postpone amount is not applied,
the time gained is in days and not in hours and more than 1 day is gained/month
(balance a few days after the start of the allocation should be +1 added_value
but is more than that).

Causes:
- the maximum amount of carry over `postpone_max_days` is applied in days
even if the accrual `added_value` is in hours and the UI shows `postpone_max_days`
as "Up to X hours".
- `get_future_leaves` returns a number of hours if the allocation is in hours, even
if the time off type is in days.
- the number of hours from the accrual at the beginning of the allocation is too
high if the start of the accrual is in the future and gain time added at the start
of the period due to cache not being invalidated.
https://github.com/odoo/odoo/blob/19c7737fc05539079cde8641bab608c605efacc5/addons/hr_holidays/models/hr_leave_allocation.py#L575-L578

opw-4272315

X-original-commit: 93756da
@robodoo
Copy link
Contributor

robodoo commented Jan 28, 2025

Pull request status dashboard

@fw-bot
Copy link
Contributor Author

fw-bot commented Jan 28, 2025

@taqu-odoo @Bertrand2 this PR targets master and is the last of the forward-port chain.

To merge the full chain, use

@robodoo r+

More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port

@robodoo robodoo added the forwardport This PR was created by @fw-bot label Jan 28, 2025
@C3POdoo C3POdoo added the OE the report is linked to a support ticket (opw-...) label Jan 28, 2025
@taqu-odoo
Copy link
Contributor

robodoo r+

robodoo pushed a commit that referenced this pull request Jan 29, 2025
Steps
- create an accrual plan with a level giving 1 hour every month and a carry
over with a maximum of 4 hours. Set accrued gain time at the start of the period
and carry-over time at start of the year.
- create an allocation using this accrual plan, for a time off type in days,
set the start date on the first day of next year.
- go to Time Off Dashboard
- check the balance on the middle of the month of the following year (e.g.
15 january 2026 if the allocation starts on 1 january 2025).

-> ~14 days of time off available: the max postpone amount is not applied,
the time gained is in days and not in hours and more than 1 day is gained/month
(balance a few days after the start of the allocation should be +1 added_value
but is more than that).

Causes:
- the maximum amount of carry over `postpone_max_days` is applied in days
even if the accrual `added_value` is in hours and the UI shows `postpone_max_days`
as "Up to X hours".
- `get_future_leaves` returns a number of hours if the allocation is in hours, even
if the time off type is in days.
- the number of hours from the accrual at the beginning of the allocation is too
high if the start of the accrual is in the future and gain time added at the start
of the period due to cache not being invalidated.
https://github.com/odoo/odoo/blob/19c7737fc05539079cde8641bab608c605efacc5/addons/hr_holidays/models/hr_leave_allocation.py#L575-L578

opw-4272315

closes #195514

X-original-commit: 93756da
Signed-off-by: Bertrand Dossogne (bedo) <bedo@odoo.com>
Signed-off-by: Tanguy Quéguineur (taqu) <taqu@odoo.com>
@robodoo robodoo added the 18.2 label Jan 29, 2025
@robodoo robodoo closed this Jan 29, 2025
@fw-bot fw-bot deleted the master-17.0-opw-4272315-hr_holidays_accrual_level_carry_hours-taqu-rcu2-fw branch February 12, 2025 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

18.2 forwardport This PR was created by @fw-bot OE the report is linked to a support ticket (opw-...)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants