Relational fields

In relational fields, we can have some additional control as to what the user can do. By default, the user can create new records from these fields (also known as "quick create") and open the related record form. This can be disabled using the options field attribute:

options="{'no_open': True, 'no_create': True}"

The context and domain are also field attributes and are particularly useful on relational fields.

The context can define the default values for the related records, and the domain can limit the selectable records. A common example is for a field to have the selection options depend on the value of another field. A field's domain can be defined directly in the Model, but it can also be overridden in the View.

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.