More time-zone issues

Bug #943091 reported by Charles McCreary
24
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Medium
OpenERP R&D Addons Team 3

Bug Description

In a similar vein as https://bugs.launchpad.net/openerp-web/+bug/918257, hr_timesheet_sheet displays "Today" as UTC, rather than the local. When manually signing in or out, the attendance is pushed to the UTC day. This is very confusing.

If I understand correctly, datetime is set to UTC in the server. In hr_timesheet_sheet_view.xml, <field name="date_current" nolabel="1"/> will always be UTC, which is not what I expect. This completely screws up the daily attendance as I sign in on one day and sign out on the next day.

What would be the recommended best practice to fix this?

Related branches

Revision history for this message
Xavier (Open ERP) (xmo-deactivatedaccount) wrote :

> In hr_timesheet_sheet_view.xml, <field name="date_current" nolabel="1"/> will always be UTC, which is not what I expect.

No, the display should use the local timezone, meaning the one used by your browser (which is generally the one set on your OS as well).

Revision history for this message
Charles McCreary (charles.r.mccreary) wrote :

Exactly, it doesn't. Timezone in browser is correct.

Revision history for this message
Charles McCreary (charles.r.mccreary) wrote :

browser timezone from Date():

Wed Feb 29 2012 08:11:18 GMT-0600 (CST)

Revision history for this message
Charles McCreary (charles.r.mccreary) wrote :

I have added a screenshot illustrating the problem

Revision history for this message
Charles McCreary (charles.r.mccreary) wrote :

I think the thread in https://bugs.launchpad.net/openobject-server/+bug/925361 properly characterizes the problem

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

You're definitely right, hr_timesheet_sheet uses a series of date (not datetime!) fields that need to be properly computed using client time instead of server time (UTC), using the same technique and for the same reasons explained on bug 925361.

Thanks for reporting and providing the very informative screenshot in comment #4!

affects: openerp-web → openobject-addons
Changed in openobject-addons:
importance: Undecided → Medium
status: New → Confirmed
assignee: nobody → OpenERP R&D Addons Team 3 (openerp-dev-addons3)
milestone: none → 6.1
Amit Parik (amit-parik)
Changed in openobject-addons:
status: Confirmed → Fix Released
Revision history for this message
Amit Parik (amit-parik) wrote :

Hi Charles,

Now in trunk Timesheet is improved with 'widget_timesheet' using a js.

So this issue doesn't affected anymore.

You can check the latest code with trunk7.0.

Thank you!

Revision history for this message
Don Kirkby (donkirkby) wrote :

Amit and Olivier, is the milestone of 6.1 wrong for this bug? Based on Amit's comments, I think that the timesheet module has been rewritten in 7.0, and the bug is not found in the new version. Please change the milestone if that's true, so it's clearer where the bug got fixed.
I'm guessing that the 7.0 version is so different from the 6.1 version that I can't just backport the fix. Is that right?

Revision history for this message
Amit Parik (amit-parik) wrote :

Hello Don Kirkby,

Thanks for your reply.

I forget to remove the milestone. Yes, you are right 6.1 and 7.0 are totally different. So you can not easily backport it.

I am setting a proper mile-stone on it.

Thank you!

Amit Parik (amit-parik)
Changed in openobject-addons:
milestone: 6.1 → 7.0
Revision history for this message
Don Kirkby (donkirkby) wrote :

I cleaned up timezone handling in the 6.1 timesheets code, and I've posted a merge proposal. The 6.1 timesheets code is currently unusable because of timezone problems, so I strongly recommend these changes.
Here are all the timesheet problems I found and fixed:
- Today button goes to UTC date instead of local date.
- Sign in and Sign out buttons put attendance records on timesheet based on UTC date instead of local date.
- Total attendance calculation is broken because of timezone problems on timesheet and timesheet by day view.
- Sign in / sign out by project menu item put attendance records on timesheet based on UTC date and didn't link the hr_analytic_timesheet records to the timesheet properly.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Bug attachments