Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] hr_holidays: apply timezone on request date #158042

Conversation

thle-odoo
Copy link
Contributor

Steps to reproduce:

  • be in a UTC+08:00 (or more) timezone
  • go to Time Off dashboard
  • click on a day (to request a leave)

Issue:

Default request dates are on 2 days instead of 1.

Cause:

Default request dates are determined during an onchange. The datetimes (default_date_from/to) are set in the context in UTC calculated in relation to the client's timezone.
Consequently, these datetimes can be set over several days. In the backend, we will use these datetimes and take only the day (because the request_date_from/to fields are of type date).

Solution:

Put the values back into the client's timezone before they are truncated.

opw-3789265

@robodoo
Copy link
Contributor

robodoo commented Mar 19, 2024

@C3POdoo C3POdoo added the OE the report is linked to a support ticket (opw-...) label Mar 19, 2024
@thle-odoo thle-odoo marked this pull request as ready for review March 21, 2024 07:22
@C3POdoo C3POdoo requested a review from a team March 21, 2024 07:24
Copy link
Contributor

@Bertrand2 Bertrand2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Did you investigate to see if it's possible to add a test?

Steps to reproduce:
-------------------
- be in a UTC+08:00 (or more) timezone
- go to Time Off dashboard
- click on a day (to request a leave)

Issue:
------
Default request dates are on 2 days instead of 1.

Cause:
------
Default request dates are determined during an onchange.
The datetimes (`default_date_from/to`) are set in the context in UTC
calculated in relation to the client's timezone.
Consequently, these datetimes can be set over several days.
In the backend, we will use these datetimes and take only the day
(because the `request_date_from/to` fields are of type date).

Solution:
---------
Put the values back into the client's timezone before they are truncated.

opw-3789265
@thle-odoo thle-odoo force-pushed the 17.0-opw-3789265-issue_timezone_time_off-thle branch from 1ec219b to 86ee2a3 Compare March 25, 2024 13:54
@Bertrand2
Copy link
Contributor

robodoo r+

@robodoo robodoo closed this in 6c4bd3c Mar 26, 2024
@fw-bot fw-bot deleted the 17.0-opw-3789265-issue_timezone_time_off-thle branch April 9, 2024 11:46
willylohws pushed a commit to willylohws/odoo that referenced this pull request May 1, 2024
Steps to reproduce:
-------------------
- be in a UTC+08:00 (or more) timezone
- go to Time Off dashboard
- click on a day (to request a leave)

Issue:
------
Default request dates are on 2 days instead of 1.

Cause:
------
Default request dates are determined during an onchange.
The datetimes (`default_date_from/to`) are set in the context in UTC
calculated in relation to the client's timezone.
Consequently, these datetimes can be set over several days.
In the backend, we will use these datetimes and take only the day
(because the `request_date_from/to` fields are of type date).

Solution:
---------
Put the values back into the client's timezone before they are truncated.

opw-3789265

closes odoo#158042

Signed-off-by: Bertrand Dossogne (bedo) <bedo@odoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OE the report is linked to a support ticket (opw-...)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants