Getting ready
This recipe assumes that you have an instance ready, with the my_library
add-on module available, as described in Chapter 3, 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 3, Creating Odoo Add-On Modules, for more information.