Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
How can I use a relative date like for example today for filtering?
I filtered all due / overdue invoices in the suppliers invoice list using the attribute "due date" "is less or equal than". As I want to create a template from this filter it should not refer to a concrete date like 22.05.2013 but to the relative date. So I could use the template every day without modification.
In version 8, you can now do this:
In version 9, you can use this as a filter:
<filter string="Today" domain="[('date_field_from_the_model_you_want_to_filter', '>=', datetime.datetime.now().strftime('%Y-%m-%d 00:00:00')),('date_field_from_the_model_you_want_to_filter', '<=',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
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 5/22/13, 2:08 PM|
|Seen: 10404 times|
|Last updated: 6/13/16, 3:28 PM|