This recipe assumes that you have an instance ready, with the my_library add-on module available, as described in Chapter 4, Creating Odoo Add-On Modules. You will need to add a state field to the LibraryBook model, which is defined as follows:
from odoo import models, fields, api class LibraryBook(models.Model): # [...] state = fields.Selection([
('draft', 'Unavailable'),
('available', 'Available'),
('borrowed', 'Borrowed'),
('lost', 'Lost')],
'State', default="draft")
Refer to the Adding models recipe in Chapter 4, Creating Odoo Add-On Modules, for more information.