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 have a list of documents (knowledge), I have my views where I filter these document by 'parent_id'. I wanted to know if there's a way to have a domain/filter that will show me:
- Only the newest document with parent_id='1'
- All the document with parent_id='1' excluding the newest.
Ordering and result limiting are both separate parts of the search function, unrelated to domain. Check the technical memento for the search() method on page 4: https://www.openerp.com/files/memento/OpenERP_Technical_Memento_v0.7.4.pdf
You'll have to put it into a separate function to generate the proper search result, but it would look something like this:
# newest_id will be a list of length 1, not an integer newest_id = self.search(cr, uid, [('parent_id','=',1)], limit=1, order='id desc')
Once you have the id of the newest record, you can difference that from the unlimited list of IDs after doing another search without the limit.
other_ids = self.search(cr, uid, [('parent_id','=',1)], limit=1, order='id desc') other_ids = other_ids - newest_id
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: 10/14/13, 3:57 AM|
|Seen: 1209 times|
|Last updated: 3/16/15, 8:10 AM|