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...