Odoo Help


This community 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.


Why can relate two fields one2many?

on 1/14/14, 5:05 PM 988 views

Hi guys, have a query, i write a OpenERP v7 module to workshop, i have a object class 'vehicle' and another object 'service', actually, each vehicle can have many services, through a one2many relational field in object 'vehicle', but I also need to do the opposite, I mean several vehicles relate to each service

Timo Talvitie
On 1/14/14, 6:20 PM

Sounds like you should use a many2many relation for this: each of your vehicles can be linked to X services, and each of your services can be linked to Y vehicles. Try using the following fields:

In your vehicle class:


And in your service class the same thing but in reverse:

    'service_rel', # same relation still
    'service_id', # ...but fields of the relation now go in different order

The documentation has some notes on m2m usage here: https://doc.openerp.com/trunk/server/03_module_dev_02/

Thanks u! that is the right way, it works 100%! you are great!

on 1/14/14, 7:35 PM

Your Answer

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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)


Asked: 1/14/14, 5:05 PM
Seen: 988 times
Last updated: 3/16/15, 8:10 AM