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 wish to link(relate) two many2one lists, for example my custom module
the account one:
'machine_ids' : fields.one2many('ng.machine', 'invoice_ids', 'GÃ©pek'),
the machine one:
'invoice_ids' : fields.one2many('account.invoice', 'machine_ids', 'SzÃ¡mlÃ¡k'),
but this gives me an error.If i change the fields to many2one then until i try to save everything works. when i try to save gives me this error:
ProgrammingError: can't adapt type 'dict'
How can i make it so that the 2 one2many list can relate to each other? bassickly on the machine's page see all the invoice that it is mentioned, and on the invoice see all the machines it mentions.
Sounds like you should use a many2many relation for this: each of your machines can be linked to X invoices, and each of your invoices can be linked to Y machines. Try using the following fields:
'machine_ids': fields.many2many( 'ng.machine', 'ng_machine_rel', 'invoice_id', 'machine_id', 'GÃ©pek'),
And in your
machine class the same thing but in reverse:
'invoice_ids': fields.many2many( 'account.invoice', 'ng_machine_rel', # same relation still 'machine_id', # ...but fields of the relation now go in different order 'invoice_id', 'SzÃ¡mlÃ¡k'),
The documentation has some notes on m2m usage here: https://doc.openerp.com/trunk/server/03_module_dev_02/
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/14/14, 11:25 AM|
|Seen: 1494 times|
|Last updated: 3/16/15, 8:10 AM|