Many-to-many relationships

The Many2many minimal signature accepts one argument for the related model, and it is recommended to also provide the string argument with the field title.

At the database level, it does not add any columns to the existing tables. Instead, it automatically creates a new relationship table that has only two ID fields with foreign keys to the related tables. If not provided, the relationship table name and the field names are automatically generated. By default, the relationship table name is the two table names joined with an underscore and _rel appended at the end.

On some occasions, we may need to override these automatic defaults.

One such case is when the related models have long names, and the name for the automatically ...

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.