Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
27580 Переглядів

Hey * .. Anyone know if there's a way to set up a "Today" option as a filter in Odoo SA (the SaaS version)? I'd like to have a dynamic date to be able to create a custom filter that I can share, but that will reference the current date, not a specific one.             

Аватар
Відмінити
Найкраща відповідь

Create a new view which inherits the view you want to change, and then add a filter:

 

<filter string="Today" domain="[('date_field_from_model', '&gt;=', datetime.datetime.now().strftime('%Y-%m-%d 00:00:00')),('date_field_from_model', '&lt;=',datetime.datetime.now().strftime('%Y-%m-%d 23:23:59'))]"/>
Аватар
Відмінити
Автор

Hey..thanks! This gave me the direction I needed. However I wasn't able to get it to show up in the view.. I ended up editing the search view directly instead of extending it. When I created the extended view it wasn't showing up in the menu. I've created a view that extends stock.picking.internal.search with the following: But it doesn't show up in the filter.. can you possibly give me a clue as to why?

Автор

" "

Автор

sorry.. it's cleaning the markup I'm posting.. anyway.. if you have any tips as to what I need to do to get it to show up in the filter menu from an extended view... let me know . I've marked your answer as correct. Thanks!

Small correction on the end time.

I believe it should be .......strftime('%Y-%m-%d 23:59:59'))]"/>

Related Posts Відповіді Переглядів Дія
0
квіт. 16
3255
0
квіт. 16
3939
0
лист. 23
1217
0
вер. 23
2119
0
вер. 23
1850