How it works...

When a model class is defined with the _inherit attribute, it adds modifications to the inherited model rather than replacing it.

This means that fields defined in the inheriting class are added or changed on the parent model. At the database layer, it is adding fields on the same database table.

Fields are also incrementally modified. This means that if the field already exists in the superclass, only the attributes declared in the inherited class are modified; the other ones are kept as in the parent class.

Methods defined in the inheriting class replace the method in the parent class. So, unless they include a call to the parent's version of the method, we will lose features. Due to this, when we want to add logic to the existing methods, they should include a statement with super to call its version in the parent class. This is discussed in more detail in Chapter 6, Basic Server-Side Development.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.130.201