April 2016
Beginner to intermediate
400 pages
9h 16m
English
Models have structural attributes defining their behavior. These are prefixed with an underscore and the most important is _name, which defines the internal global identifier for the Model.
There are two other attributes we can use. One to set the field used as a representation, or title, for the records, and another one to set the order they are presented in.
This recipe assumes that you have an instance ready with my_module, as described in Chapter 3, Creating Odoo Modules.
The my_module instance should already contain a Python file called models/library_book.py, which defines a basic model. We will edit it to add a new class-level attribute after _name: