Odoo 12 Development Cookbook - Third Edition
by Parth Gajjar, Alexandre Fayolle, Holger Brunn, Daniel Reis
How it works...
An abstract model is created by a class based on models.AbstractModel, instead of the usual models.Model. It has all the attributes and capabilities of regular models; the difference is that the ORM will not create an actual representation for it in the database. This means that it can't have any data stored in it. It only serves as a template for a reusable feature that is to be added to regular models.
Our Archive abstract model is quite simple; it just adds the active field and a method to toggle the value of the active flag, which we expect to be used later, via a button on the user interface.
When a model class is defined with the _inherit attribute, it inherits the attribute methods of those classes, and the attribute ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access