← Back to team overview

openerp-community team mailing list archive

Re: time zone adjustment in MAKO files?

 

Does anyone know how to calculate local time in a mako report? This

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


is not working for me.



On Fri, May 10, 2013 at 8:30 AM, Dale E. Moore <daleemoore@xxxxxxxxx> wrote:

> Thanks for the feedback Cristian Salamea!
>
> The user preferences are America/Chicago but what's being
> displayed/printed is UTC.
>
>
> On Fri, May 10, 2013 at 8:05 AM, Ovnicraft <ovnicraft@xxxxxxxxx> wrote:
>
>>
>>
>>
>> On Fri, May 10, 2013 at 7:32 AM, Dale E. Moore <daleemoore@xxxxxxxxx>wrote:
>>
>>> I've used
>>>
>>> from dateutil import tz
>>>
>>>
>>>
>>>
>>> from_zone = tz.tzutc()
>>>
>>>
>>>
>>>
>>> to_zone = tz.tzlocal()
>>>
>>>
>>>
>>>
>>> arrive = arrive.replace(tzinfo=from_zone)
>>>
>>>
>>>
>>>
>>> arrive_central = arrive.astimezone(to_zone)
>>>
>>>
>>>
>> in hr_timesheet_invoice_create.py to output the correct local time but
>>> that isn't working for me in some MAKO reports.
>>>
>>> Do you know how to get the correct local time out of a MAKO report?
>>>
>>
>> Hello, AFAIK you always must compute in UTC, TZ comes from user
>> preferences.
>>
>> Regards,
>>
>>>
>>> I look forward to hearing from you,
>>> DaleEMoore@xxxxxxxxx
>>>
>>>
>>>
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~openerp-community
>>> Post to     : openerp-community@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~openerp-community
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>>
>>
>>
>> --
>> Cristian Salamea
>> @ovnicraft
>>
>
>

Follow ups

References