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', '>=', datetime.datetime.now().strftime('%Y-%m-%d 00:00:00')),('date_field_from_model', '<=',datetime.datetime.now().strftime('%Y-%m-%d 23:23:59'))]"/>
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 3/30/16, 7:08 PM|
|Seen: 804 times|
|Last updated: 10/24/16, 3:38 PM|