Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
6364 Zobrazení

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?

Thanks,

jgonzalez

 

Avatar
Zrušit
Autor

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

Nejlepší odpověď

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.

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
3
lis 24
29944
1
úno 24
1961
2
lis 23
6964
0
čvc 24
3004
0
čvc 22
60