In this recipe, we will add the constraints in library.book model. To do so we will use the my_library module from Chapter 4, Creating Odoo Add-On Modules.
We expect it to contain at least the following:
from odoo import models, fields
class LibraryBook(models.Model):
_name = 'library.book'
name = fields.Char('Title', required=True)
date_release = fields.Date('Release Date')