Model attributes

Model classes can use additional attributes that control some of their behaviors. These are the most commonly used attributes:

  • _name is the internal identifier for the Odoo model we are creating. Mandatory when creating a new model.
  • _description is a user-friendly title for the model's records, shown when the model is viewed in the user interface. Optional but recommended.
  • _order sets the default order to use when the model's records are browsed, or shown in a list view. It is a text string to be used as the SQL order by clause, so it can be anything you could use there, although it has smart behavior and supports translatable and many-to-one field names.

For completeness, there are a couple more attributes that can be ...

Get Odoo 11 Development Essentials - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.