← Back to team overview

openerp-community team mailing list archive

How to use datetime + timedelta on odoo filters

 

Hi,

When a company works in a timezone different from GMT, filters by datetime
get screwed up.

Example:
If user timezone is GMT-6:00, then any of current "Today" filters will
filter only records from tomorrow if current local time is after 18:00
 (18:00 + 6:00 = 24:00 -->> next day).

I was trying to adjust for that replacing time.strftime('%Y-%m-%d') with

(datetime.datetime.now()+datetime.timedelta(hours=6)).strftime('%Y-%m-%d
 %H:%M:%S')

as all records created today after 18:00 will have a database timestamp of
tomorrow...


Problem is JS complains about invalid operands for "+": datetime and
timedelta...

Any idea how could this be acomplished ?

Regards,
-Mario

Follow ups