In-place Model extension

Our first task is to add the is_available Boolean field to the Book Model. For this, we will use the classic, in-place, Model extension. The value for this field could be automatically computed, based on the book borrow and return transactions, but for now, we will keep it as a simple field.

To extend an existing Model, we will use a Python class with an _inherit attribute, thus identifying the Model to be extended. The new class inherits all of the features of the parent Odoo Model, and we only need to declare the modifications we want to introduce. These modifications will also be available everywhere else this Model is used. We can think of this type of inheritance as getting a reference for the existing Model and making in-place changes to it.

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

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