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

Consider alternative recording of timezone #158

Open
ccremer opened this issue Dec 23, 2022 · 2 comments · May be fixed by #161
Open

Consider alternative recording of timezone #158

ccremer opened this issue Dec 23, 2022 · 2 comments · May be fixed by #161
Labels
enhancement New feature or request

Comments

@ccremer
Copy link
Contributor

ccremer commented Dec 23, 2022

Currently we save the timezone in the payslip and it applies to the whole month.
This is a major drawback for people that are changing timezones in the middle of the month, because recording attendance becomes a major pain.

The most correct way is to record attendance with the timezone information. Unfortunately Odoo 8 stores timestamps in UTC without timezone flag.

It might be possible to add a column in the timesheet view that contains the timezone field. If possible, an implementation could look like this:

  • Add the x_timezone field to the Attendance data model in Odoo
  • Add a column timezone to the timesheet view. The users working abroad can then set the timezone for each attendance, similarly how Sick Leave is recorded in a Dropdown menu.
  • If the field is empty, default to Europe/Zurich, either via Odoo itself or at latest in Odootools.
  • No longer save the timezone in the payslip
  • In odootools, apply the following precedence for timezone selection (first to last):
    • x_timezone field of an Attendance entry
    • x_timezone field of the current month's payslip
    • timezone setting in the user preferences
    • Europe/Zurich as the last-resort fallback (so that Switzerland-based employees don't need to change anything)

There is one advantage with saving the timezone in payslip: A timezone can be applied to the whole month. So if an employee is the whole month outside Switzerland, they can just save it once in the payslip and not record every individual attendance with the timezone field.

That being said, this feature resp. extra column is only relevant for people changing the timezone in the middle of the month, since the timezone for a whole month can still be specified via payslip.

Reasoning: User experience
It's easier to record attendance in the local timezone and set the timezone in the column from a dropdown, than having to record all attendances of a month in a single timezone when changing timezones in the middle of the month.

@ccremer ccremer added the enhancement New feature or request label Dec 23, 2022
@ccremer
Copy link
Contributor Author

ccremer commented Dec 23, 2022

I've just tested this in our test Odoo (july 2022 instance) and it was easy to add a field and column:
image

@ccremer
Copy link
Contributor Author

ccremer commented Dec 23, 2022

Implementation challenge in Odootools:
In the Report.prepareDays method we create the DailySummary data objects for each day in advance. Those are until now always in the same timezone. Now, if we consider the edge case where someone works on the same day as the flight (e.g. at the airport or offline during the flight) then travelling vancouver would be "going back in time" and the shifts might be associated to the wrong day. Granted, this is an edge case that we can avoid by putting the hours elsewhere.

However, sorting the attendances ascending by date will also be somewhat tricky.

We might deal with this by displaying a day twice in the report, one for each timezone.

@ccremer ccremer linked a pull request Jan 4, 2023 that will close this issue
4 tasks
@ccremer ccremer linked a pull request Jan 4, 2023 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant