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. So, it can have no data stored in it. It serves only 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 later be used 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 what is defined in our class adds modifications to these inherited features.

The mechanism at play here is the same as that for a regular model extension (as per the Adding features to a Model using inheritance recipe). You may have noticed that here, _inherit uses a list of model identifiers instead of a string with one model identifier. In fact, _inherit can have both forms. Using the list form allows us to inherit from multiple (usually Abstract) classes. In this case, we are inheriting just one, so a text string would be fine. A list was used instead to underline that a list can be used.