Defining the model representation and order
Models have structural attributes for defining their behavior. These are prefixed with an underscore. The most important attribute of the model is
_name, as this defines the internal global identifier. Internally, Odoo uses this
_name attribute to create a database table. For example, if you provide
_name="library.book", then the Odoo ORM will create the
library_book table in the database. And that's why the
_name attribute must be unique across Odoo.
There are two other attributes that we can use on a model:
_rac_nameis used to set the field that's used as a representation or title for the records.
- The other one is
_order, which is used to set the order in which the records are presented.
This recipe assumes that you have an instance ready with the
my_library module, as described in Chapter 3, Creating Odoo Add-On Modules.
How to do it...
my_library instance should already...