Commit Graph
6 Commits
Author SHA1 Message Date
Xavier-Do e9b62b47dc [FIX] *: adapt tz for Ubuntu Noble
Some of the non canononical timezones are not present in Ubuntu Noble,
it would be a better practice to only use canonical timezones in data
and tests.

Note that this is not a real fix for all cases since the database that
ran on Ubuntu Jammy and are moved to an ubuntu Noble server will have
the issue with timezones already in database.

One of the possible fix would be to manage that during upgrades, but
this isn't a verry flexible solution since upgrade are meant to manage
chyange of version, not change of server. If an old 17.0 versions needs
to be moved to a Noble server, this won't work.

Another solution would be to install package like tzdata-legacy that may
keep the old timezones but it is not the only think since TAI-10 are
also in this package. This solution is not ideal because non canonical
timezone will still be shown in the dropdown. We would need to filter
them.

A last solution would be to add the support for those old timezones by
monkeypatching the lib. This way, only new timezones would be shown but
non canonical one won't crash when used. This is not ideal either
because we may need to keep this for a while. But in combination with
the upgrade solution, it may work proprely.

Part-of: odoo/odoo#160842
2024-04-07 10:03:48 +00:00
Yannick Tivisse a8e010c7b5 [FIX] hr_holidays: Make tests demo data independent
Part-of: odoo/odoo#146649
2023-12-18 23:32:05 +00:00
jugj-odoo 8b978ab01d [FIX] resource : fix traceback in _get_attendance_intervals_days_data with adjacent attendances
----------------------Issue--------------------------
When calling get_work_duration_data on a calendar that contains adjacent calendar attendances,
we get a traceback in the method _get_attendance_intervals_days_data.
This is due to the fact that adjacent attendances (like 09:00 -> 13:00, 13:00 -> 17:00) will get merged into one single interval.
Which will generate an attendance interval with multiple resource.calendar.attendance records associated with it.

----------------Steps to reproduce-------------------
1) Create a Calendar
2) Create for a same day 2 attendances going from 09:00 to 13:00 and another going from 13:00 to 17:00 3) Try creating a time-off for that day
3) Associate that calendar with an employee
4) Try creating a time off on the day where we have adjacent attendances
---------------------Fix-----------------------------
Adapt _get_attendance_intervals_days_data to handle attendance intervals associated with multiple resource.calendar.attendance

task-3615723

closes odoo/odoo#144036

Signed-off-by: Bertrand Dossogne (bedo) <bedo@odoo.com>
2023-12-06 09:53:19 +00:00
Rob Coekaerts a9b804b1ad [IMP] resource: add duration to resource_calendar_attendance
Before this commit, conversion between worked hours and days in
resource_calendar_attendance was calculated but in reality there is no
unambigous way to do this. Eg in Belgium the morning working period is
4 hours, the one in the afternoon is 3 hours 36 minutes, while both of
them are still counted as half days.

To mediate this, the duration in days is explicitely added to
resource.calendar.attendance, with sensible default being provided
(half a day for morning and afternoon periods, 0 for lunch).

task-3131517

Part-of: odoo/odoo#133145
2023-10-24 12:38:09 +00:00
Thomas Lefebvre (thle) 0f08587e6c [FIX] resource: manage two weeks calendar and company creation
Steps to reproduce:
-------------------
- Go to Working Time and modify a calendar using "Switch to 2 weeks calendar"
    (not the default company calendar);
- In the Employees App settings, change the "Company Working Hours"
    to the edited calendar;
- Create a new company.

Issue:
------
We have the error: "Attendances can't overlap.".

Cause:
------
When we create a company, we will use the `_default_get` method
to get the default values for the `attendance_ids`.
So we will copy the attendances from the current company,
but we won't copy the `week_type` value.
In addition, the `two_weeks_calendar` value will be `False`.

As a result, overlaps will be checked as for a one-week calendar.
This will trigger the error.

Solution:
---------
If you want to get the current company's attendances by default,
make sure it uses a one-week calendar.
If this is not the case, we take the default (hardcoded) attendances.

Note:
-----
Since the commit 292508e8a749bf32e40995454da6122cd3c1df77,
it was no longer possible to modify a company's default calendar.
It is reverted.

With this FIX, this is now possible.

opw-3446789

closes odoo/odoo#131872

X-original-commit: 22c12db1f009686fa4c3861c398ba178b2785ead
Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
Signed-off-by: Thomas Lefebvre (thle) <thle@odoo.com>
2023-08-14 14:52:12 +02:00
Yannick Tivisse 1da5b4e802 [IMP] resource: Move test models in their own module
Purpose
=======

When creating resources, SQL request were made to this test table.

Part-of: odoo/odoo#85133
2022-02-28 17:27:07 +00:00