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.
I want to sort my lists by a computed field "due_days" (number of days - computed from "due_date").
I could do this by setting "store=True" on due_days, but then the compute method depends on the current date. How can I then be sure, that the value is re-computed when the current date changes?
It would also be easy to implement a new search method. Searching on due_days is the same as searching on due_date with ASC/DESC order reversed. But how can I tell Odoo to sort by this order?
I'm aware of the @api.depends decorator, but as far as I can see, it can only be triggered by other fields. As the "due_days" field depends on both "due_date" and the current date, we also need to re-calculate due_days when the current date changes.
Maybe I wasn't clear on the sorting, but I want the user to be able to choose the sorting when they see a list.
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: 6/7/15, 9:26 AM|
|Seen: 661 times|
|Last updated: 7/13/15, 2:51 PM|