vshn / odootools

VSHN-specific Odoo tool suite
https://odootools.vshn.net
BSD 3-Clause "New" or "Revised" License
3 stars 0 forks source link

Consider alternative recording of timezone #158

Open ccremer opened 1 year ago

ccremer commented 1 year ago

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:

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 commented 1 year ago

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

ccremer commented 1 year ago

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.