Relationships between models

Looking again at our module design, we have these relationships:

  • Each task has a stage. That's a many-to-one relationship, also known as a foreign key. The inverse is a one-to-many relationship, meaning that each stage can have many tasks.
  • Each task can have many tags. That's a many-to-many relationship. The inverse relationship, of course, is also a many-to-many, since each tag can be in many tasks.

The following entity relationship diagram can help visualize the relationships we are about to create in the model. The lines ending with a triangle represent the many sides of the relationships:

Let's add the corresponding ...

Get Odoo 11 Development Essentials - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.