Book Image

Odoo Development Cookbook

By : Holger Brunn, Alexandre Fayolle, Daniel Reis
Book Image

Odoo Development Cookbook

By: Holger Brunn, Alexandre Fayolle, Daniel Reis

Overview of this book

Odoo is a full-featured open source ERP with a focus on extensibility. The flexibility and sustainability of open source is also a key selling point of Odoo. It is built on a powerful framework for rapid application development, both for back-end applications and front-end websites. The book starts by covering Odoo installation and administration, and provides a gentle introduction to application development. It then dives deep into several of the areas that an experienced developer will need to use. You’ll learn implement business logic, adapt the UI, and extend existing features.
Table of Contents (23 chapters)
Odoo Development Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Using Delegation inheritance to copy features to another Model


Traditional inheritance using _inherit performs in-place modification to extend the model's features.

But there are cases where rather than modifying an existing model, we want to create a new model based on an existing one to leverage the features it already has. This is one with Odoo's delegation inheritance that uses the model attribute, _inherits (note the additional s).

Traditional inheritance is quite different than the concept in object-oriented programming. Delegation inheritance in turn is similar in that a new model can be created to include the features from a parent model. It also supports polymorphic inheritance, where we inherit from two or more other models.

We have a library with books. It's about time for our library to also have members. For a library member, we need all the identification and address data found in the Partner model, and we also want it to keep some information regarding the membership: a start...