Thomas Lefebvre (thle) e937d480d0 [FIX] hr_attendance: correct timezone in report
Steps to reproduce:
-------------------
- with timezone "Europe/Brussels" (UTC +02:00);
- create an attendance that starts at 1:00 AM;
- go to pivot view in Reporting tab.

Issue:
------
Attendance appears to be a day early.

Cause:
------
When converting a date to UTC for database storage,
it's possible that the date may change
(due to a large offset or hours close to 00:00).
Therefore, when we use `CAST(check_in as DATE)`,
we will keep the date that has potentially changed.

Solution:
---------
Use postgresql's `at time zone <timezone_name>`
statement to convert the recorded attendance
to UTC in the employee's timezone.

Note:
-----
On an employee's form view, the "Working Hours" field
(`resource_calendar_id`) is required.
The `resource_calendar_id` field is a Many to One
to the `resource.calendar` model.
The `resource.calendar` model contains
the `tz` field, which is required.

As a result, it will always be possible to find
an employee's timezone via his calendar resource.

Hypothesis:
-----------
Attendances are created using the browser's timezone.
It is normal to think that the employee's
calendar timezone is the same as his browser timezone.

opw-3370874

closes odoo/odoo#127989

X-original-commit: 8ac7e19ce94685438ab16f052c6550e86e692a75
Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
2023-07-10 21:25:51 +02:00
…
…
…

Build Status Tech Doc Help Nightly Builds

Odoo

Odoo is a suite of web based open source business apps.

The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...

Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.

Getting started with Odoo

For a standard installation please follow the Setup instructions from the documentation.

To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials

S
Description
No description provided
Readme LGPL-3.0
3.4 GiB
Languages
Python 49.6%
JavaScript 47.8%
SCSS 2%
CSS 0.3%
HTML 0.2%