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 am trying to use the mapped() operation on a recordset in v8, as described in:
I use it on a recordset of model A to retrieve all the records in a field_a, which is a Many2one,
expected_ids = recorsetA.mapped('field_a')
but it fails with this error:
File "/mnt/workZone/odoo/odoo_8_devel/code/OCA/OCB/openerp/models.py", line 5196, in ensure_one
raise except_orm("ValueError", "Expected singleton: %s" % self)
except_orm: ('ValueError', 'Expected singleton: res.better.zip(32506, 32503, 32505, 32504, 32502, 32508, 32507, 32509, 32510, 32512, 32511, 32513, 32514, 32515, 32516, 32527, 32526, 32525, 32524, 32523, 32522, 32521, 32520, 32519, 32518,
It works with other kind of field, like Char, Int or even Many2one (but not a Many2many or One2many), like this
result_ids = recorsetA.mapped('id')
Do I need to do anything else to retrieve a recordset with all the objects within the m2m fields of the records in my recordset?
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: 1/22/15, 2:48 PM|
|Seen: 1939 times|
|Last updated: 5/26/15, 1:42 PM|