Home › Curriculum › Odoo Developer › Models and fields
The ORM · 18 min · 17–20Models and fields
Model types and attributes, every field type and its common parameters.
In this lesson
- Model kinds and attributes
- Field types
- Field parameters and naming
Key points
- Model, TransientModel, AbstractModel
- _name, _description, _inherit, _order, _rec_name; models.Constraint/Index in 19+
- Char, Text, Html, Integer, Float, Monetary, Boolean, Date, Datetime (UTC), Selection, Binary, Image
- string, required, readonly, default, index, copy, groups, tracking, translate, company_dependent
Real-world example
A Float for prices was declared without digits; invoices showed 3.3333333 kobo amounts. Changing it to Monetary with currency_field='currency_id' aligned rounding with the currency and fixed totals in every report.
Questions and answers
What does copy=False do?
The field isn't copied when the record is duplicated.
Which parameter makes a field's value differ per company?
company_dependent=True.