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.
If we obtain a recordset of model instances (through search() or browse()), what kinds of operations are available? Can recordsets be added (set + set)? Can they be appended to (setA.append(record))?
Does the recordset behave like some well known Pythonic structure (like list)? If not, is there some kind of reference that lists what operations are and aren't available?
Other recordset operations:
1. sorted(): To sort a recordset
# sort records by name
recset.sorted(key=lambda r: r.name)
2. filtered(): To filter a recordset:
# only keep records whose company is the current user's
records.filtered(lambda r: r.company_id == user.company_id)
# only keep records whose partner is a company
3. mapped(): To map a recordset by applying the provided function to each record in the recordset and returns a recordset if the results are recordsets.
recordset.mapped(lambda record: record.amount + record.tax_amount)
# returns a list of name
# returns a recordset of partners
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: 9/3/14, 4:31 AM|
|Seen: 3715 times|
|Last updated: 10/30/15, 3:35 AM|