Commit Graph
9 Commits
Author SHA1 Message Date
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
Yannick Tivisse b9b165db7d [FIX] hr_work_entry_contract: Correctly compute work entries for edge timezones
closes odoo/odoo#124222

Related: odoo/upgrade#4699
Related: odoo/enterprise#41253
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2023-08-17 10:32:54 +02: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 7bce5f3f95 [MOV] resource: Split files according to coding guidelines 2023-02-03 10:25:00 +01:00
niyasraphy 999043b36c [IMP] *: change leave string's to time off
update various string/labels contains "Leave" in hr_holidays, hr_work_entry_contract, resource, test_resource and project_timesheet_holidays modules to "Time Off"

closes odoo/odoo#107504

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2022-12-09 16:40:58 +01:00
MerlinGuillaume eeecb6f7c0 [FIX] resource: show planning resource in its timezone
Work hours in a planning do not respect the timezone

Steps to reproduce:
1. Set your computer timezone to 'America/New_York'
2. Install Manufacturing
3. Go to Settings > Manufacturing > Operations and enable Work Orders
4. Go to Settings > Technical > Resource > Working Times and open
   'Standard 40 hours/week' (San Francisco)
5. Edit the timezone to 'America/New_York'
6. Go to Manufacturing > Planning > Planning by Workcenter and trigger
   the day view
7. The work hours are not correct as they do not respect the timezone

Solution:
Add the timezone of the resource's calendar when computing
unavailabilities

opw-2903591

closes odoo/odoo#102066

X-original-commit: c7ac0ec29d69abdd5eda8887b6ec194db53419fd
Related: odoo/enterprise#32250
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
Signed-off-by: Guillaume Merlin (megu) <megu@odoo.com>
2022-10-04 16:01:19 +02:00
Víctor Martínez 2ff8701447 [FIX] resource: Fix _attendance_intervals_batch for 2 weeks calendars
TT34416

X-original-commit: 50e0c7cdce146f7f25a2369edc221877e97d6a1f
Part-of: odoo/odoo#96632
2022-07-27 04:53:13 +02:00
Victor Feyens b3869ab297 [IMP] resource, hr: avoid updating resources directly after their creation
Make sure related values are correctly propagated to the
resource.resource creation, and discard the inverse update post record
creation when it doesn't change anything

closes odoo/odoo#85601

Related: odoo/enterprise#25664
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2022-03-29 10:56:25 +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