Defining model methods and using API decorators
In Odoo models, a class is a mixture of field definitions and business logic methods. In Chapter 4, Application Models, we saw how to add fields to a model. Now we will see how to add methods and business logic to a model.
In this recipe, we will see how we can write a method that can be called by a button in the user interface, or by another piece of code in our application. This method will act on LibraryBook
and perform the required actions to change the state of a selection of books.