Attendance Sign-In Timestamps

Asked by Johan Venter

Hi all,

With the hr_timesheet and hr_attendance modules installed, when I go to Human Resources -> Attendances -> Sign in / Sign out by project, the timestamp in the "Current Date" field is consistently 15 hours ahead.

This field is annotated with "(local time on the server)" which is just not the case. We are at GMT+10, and I have checked the following:
- timezone of the machine is correct
- output of 'date' is correct
- output of time.strftime('%Y-%m-%d %H:%M:%S') from Python shell is correct
- SELECT NOW() in PostgreSQL is correct

This does not only happen on that form, but seems to be a consistent problem anywhere the Attendance functionality is.

I have searched through the code as much as possible and cannot find anywhere where this value may have been computed incorrectly. I even went so far as to think it might be the Javascript on the client side but disabling Javascript still results in the wacky value.

So, all timestamps everywhere else on the server (command line, Python, Postgres) are correct, but this one is not. It's very hard to believe it's a timezone problem as like I said, we are GMT+10, but the timestamp is always 15 hours in the future, which just makes no sense at all.

Any ideas on how to fix this?

Regards,
Johan

Question information

Language:
English Edit question
Status:
Answered
For:
OpenERP Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) said :
#1

Hello Johan,

I had a look at the code and I am in GMT + 5-30. It always shows me the current date .

Even the code suggests that to be the time.strftime('%Y-%m-%d %H:%M:%S').

When I signed in, it was current datetime and When i signed out, it was again the current datetime.

Thank you.

Revision history for this message
Johan Venter (johan-venter) said :
#2

Ah, the old "worksforme" response :)

Is there anything else I can check? Any code you could point me at that might be causing the problem? Any settings I might have missed?

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) said :
#3

Hi Johan,

The file hr_attendance/wizard/sign_in_out.py has _get_empid() and _get_empid2() methods.

These methods set the time on Current Date field.

You may try to change a date here and let any specific datetime to be put,can do like time.strftime('%Y-%m-1 %H:%M:%S').
Can simply remove that from returning dictionary.

This may help you to trace whether this is the code that is causing problems for you or not.

Thank you.

Revision history for this message
Johan Venter (johan-venter) said :
#4

Hi Jay,

hr_attendance/wizard/sign_in_out.py only appears to have _get_empid, while hr_timesheet/wizard/sign_in_out.py appears to have both functions you mentioned.

If I change 'server_date' directly to '2009-01-01 00:00:00' in _get_empid in hr_timesheet/wizard/sign_in_out.py when I go to Human Resource > Attendances > Sign in / Sign out by project the Current Date in the form is '2009-01-01 15:00:00' - EXACTLY 15 hours out!

Where else can I look for where this might be happening?

I also thought it might've been the client side Javascript, but if I disable Javascript and reload the page the result is exactly the same.

Any other ideas?

Regards,
Johan

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) said :
#5

Hi Johan,

I am sorry, I was intended to ask you for hr_timesheet only.

Its running quite normally on GTK.

I will come back to you soon after I check on web client(eTiny).

Thank you for your time.

Revision history for this message
Johan Venter (johan-venter) said :
#6

Hi Jay,

Please be aware that this problem happens to us in both the web client and the GTK client.

Any further help would be very much appreciated.

Regards,
Johan

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) said :
#7

Hi Johan,

Its not an issue with any PC we checked.

Is it possible that we can connect to your server and check?

As per what you said, its a problem in both Clients,it could be the locale/server the culprit,.

Thank you.

Revision history for this message
Johan Venter (johan-venter) said :
#8

Hi Jay,

I was creating you a new user in our system so you could connect and I discovered something.

When I created your username, I did not specify a Timezone in the user settings - with this field left blank the timestamp in the Sign In/Out form is fine, however if I set this to "Australia/Brisbane" the +15h timestamps result (still a very odd result, considering "Australia/Brisbane" is GMT+10).

Does this help you with replication? Have you got the timezone set on your users on your test machines?

Cheers,
Johan

Revision history for this message
Johan Venter (johan-venter) said :
#9

Hi Jay,

Do you have any further thoughts on this problem given the above added information?

To recap, the timestamps in hr_attendance/hr_timesheet for signing in and out are completely wrong if a User is assigned a Timezone in their properties.

I hope you are able to replicate the issue now. If not, I would be happy to provide you with access to our test ERP environment to see the problem first-hand.

Cheers,
Johan

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) said :
#10

Hi Johan,

I really could not face the error.
I would like to access your server,so I can sense the root cause of the problem.

<email address hidden>

Thank you.

Can you help with this problem?

Provide an answer of your own, or ask Johan Venter for more information if necessary.

To post a message you must log in.