openerp-community team mailing list archive
Mailing list archive
Re: How to use datetime + timedelta on odoo filters
Also, using in filters
is not working on v8. Would this be solved with web_relativedelta module ?
I checked and it is not in use even on 7.0...
Has that been deprecated on xml files ?
On Sun, Sep 28, 2014 at 11:48 PM, Holger Brunn <hbrunn@xxxxxxxx> wrote:
> Hi Mario,
> > 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).
> this is caused by https://bugs.launchpad.net/ocb-server/7.0/+bug/1255612,
> patch should still work for 8.0, I think:
> > 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
> > tomorrow...
> > Problem is JS complains about invalid operands for "+": datetime and
> > timedelta...
> That's because the '+' operator is only defined on timedelta + timedelta:
> > Any idea how could this be acomplished ?
> but I think you won't be completely happy with that, as what you actually
> to search for is presumingly:
> [utc representation of $localdate 00:00:00] <= date_field <= [utc
> representation of $localdate 23:59:59]
> and that's where the above patch comes in handy.
> Therp - Maatwerk in open ontwikkeling
> Holger Brunn - Ontwerp en implementatie
> mail: holger@xxxxxxxx
> web: http://therp.nl
> 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