← Back to team overview

openerp-community team mailing list archive

Re: How to use datetime + timedelta on odoo filters

 

I have it all working now, just by fixing original Odoo modules...

What is needed:

   - Define context_to_utc_timestamp, inverse function to
   context_timestamp...  PR : https://github.com/odoo/odoo/pull/2914
   - Update PR #2776 from Holger, to use "context_to_utc_timestamp" instead
   of "context_timestamp"
   - For filters in views, use domain tuples
   like ('date','<=',context_today().strftime('%%Y-%%m-%%d').  This is
   important, as filter date should be based on user's context
   - If you want time deltas, then use something
   like (context_today()+relativedelta(days=-1)).strftime('%Y-%m-%d')
   - Finally, if you need replace, it is not defined for dates.  I made a
   PR for that too...  https://github.com/odoo/odoo/pull/2915


Regards,
-Mario

On Sat, Oct 4, 2014 at 9:55 AM, Ovnicraft <ovnicraft@xxxxxxxxx> wrote:

>
>
> On Mon, Sep 29, 2014 at 6:50 AM, Nhomar Hernández <nhomar@xxxxxxxxx>
> wrote:
>
>>
>> 2014-09-29 3:45 GMT-04:30 Holger Brunn <hbrunn@xxxxxxxx>:
>>
>>>
>>> I created a PR for that: https://github.com/odoo/odoo/pull/2759
>>
>>
>> It is runbot red :-(
>>
>>
> Runbot was updated and green now, why odoo dont get in touch with this
> script kiddie bugs ?
>
>>
>> --
>> --------------------
>> Saludos Cordiales
>>
>>   [image: --]
>> Nhomar Hernandez
>> [image: http://]about.me/nhomar
>>      <http://about.me/nhomar?promo=email_sig>
>>
>>
>> _______________________________________________
>> 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
>>
>>
>
>
> --
>
> [image: Cristian Salamea on about.me]
>
> Cristian Salamea
> about.me/ovnicraft
>     <http://about.me/ovnicraft>
>
> _______________________________________________
> 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
>
>

References