Extending models

To extend an existing model, we use a Python class with an _inherit attribute, identifying the model to be extended. The new class inherits all the features of the parent Odoo model, and we only need to declare the modifications we want to introduce. These modifications will also be available everywhere else this model is used. We can think about this type of inheritance as getting a reference for the existing model and making in-place changes to it.

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.