A common requirement when writing business logic methods is creating new records. This recipe explains how to create records of the library.book.category model. For our example, we will add a method that will create dummy categories for the library.book.category model. To trigger this method, we will add a button to the form view.
Creating new records
Getting ready
You need to know the structure of the models for which you want to create a record, especially their names and types, as well as any constraints that exist on these fields (for example, whether some of them are mandatory). For this recipe, we will reuse the my_library module from Chapter 5, Application Models. Take a look at the following example to quickly recall...