Odoo Help


Times not adjusted for timezone?

Dale E. Moore
on 5/5/13, 1:09 PM 1,538 views

Why is it that hr_timesheet_invoice_create.py needs

from dateutil import tz
from_zone = tz.tzutc()
to_zone = tz.tzlocal()
arrive = arrive.replace(tzinfo=from_zone)
arrive_central = arrive.astimezone(to_zone)

to display the correct time information?

And it seems .mako files are even further away from displaying the correct time information. This code doesn't work in mako files; I still get UTC.

Moore Works, Dale E. Moore
on 5/10/13, 10:08 AM
Dale E. Moore
On 5/14/13, 1:40 PM

The following code works fine in my makos.

import pytz
# ...
time_local = 'America/Chicago'
time_fmt = "%Y-%m-%d %H:%M"
arrive_dt = datetime.utcnow()
TestDt = testDt.astimezone(pytz.timezone(time_local))

Good luck!

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 5/5/13, 1:09 PM
Seen: 1538 times
Last updated: 3/16/15, 8:10 AM