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.


Can I create a model out of the relation table in a many2many relationship?

on 6/25/14, 1:00 PM 636 views

Hi, when creating a many2many relationship like in the following example.

'tag_ids': fields.many2many("task.tags", "task_tags_rel", "task_id", "tag_ids", string="Task Tags"),

The framework creates the relation table "task_tags_rel". As a result, I don't have any model for that particular table as I have for the rest of the others. I need to have some extra fields in the relation table "task_tags_rel" as a result of that relation allowing me to have a model I can create a view for. Can I create a model out of the relation table in a many2many relationship?




I found a work-around for what I wanted to do. Although I know a model can't be made out of the many2many relation table at present time I'd have liked to hear from someone going through the same experience. Thanks jgonzalez

on 7/2/14, 1:20 PM

Leonardo Donelli

--Leonardo Donelli--
| 5 4 8
Cave, Italy
--Leonardo Donelli--

Physics student and part-time developer.

Leonardo Donelli
On 7/2/14, 3:38 PM

Just create the model you need, and give it a one2many field for table A and one2many field for table B. Your model will then be your many2many link between table A and table B, if you want tou can even write some methods to get all Table B record ids given a Table A record id and viceversa.

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

1 follower(s)


Asked: 6/25/14, 1:00 PM
Seen: 636 times
Last updated: 3/16/15, 8:10 AM