The Odoo Field Types, Explained

A field holds a kind of information, and Odoo has field types for the different kinds. An overview.

A model's fields hold the pieces of information a record consists of, and information comes in different kinds. Odoo has field types for those. This piece is an overview of the Odoo field types.

Why there are field types

A field holds a piece of information, but information is not all of one kind. A piece of information might be text, or a number, or a date, or a yes-or-no, or a connection to another record, and these are genuinely different kinds of thing. So Odoo has different field types, a type of field for each kind of information, so that a field is defined as the type that genuinely matches the kind of information it holds. Defining a model's fields means, in part, choosing the right field type for each.

The broad kinds of field type

Odoo's field types cover the kinds of information a record holds. There are field types for text, holding textual information, of which there are forms for shorter and longer text and for rich content. There are field types for numbers, holding numeric information, of which there are forms for whole numbers, for numbers with decimals, and for monetary amounts. There are field types for dates and times. There is a field type for a yes-or-no, a boolean. There is a field type for a selection, where the value is one of a defined set of options. There are field types for binary content, such as a file or an image. And there are the relational field types, which hold connections to other records, and which are important enough to consider in their own right. Together, the field types cover the kinds of information a record can hold.

Choosing the right field type

The practical point for a developer defining a model's fields is to choose, for each field, the field type that genuinely matches the kind of information the field holds. A piece of information that is genuinely a number should be a number field, of the form that suits it; a piece that is genuinely a date should be a date field; a piece that is genuinely one of a defined set of options should be a selection field; and so on. Choosing the right field type matters because the field type is not just a label; it determines how the information is genuinely held and handled, and a field of the wrong type handles the information wrongly. Defining a model well means each field being the type that genuinely fits its information.

The relational field types matter especially

An honest note. Among the field types, the relational ones, the field types that hold connections between records, are especially important, because the connectedness of records is central to how Odoo works. A developer defining a model has to handle the relational fields, the connections this kind of record genuinely has to others, with particular thought. The relational field types are significant enough that they warrant their own consideration, beyond this overview.

The takeaway

The Odoo field types are the different kinds of field for the different kinds of information a record holds: types for text, for numbers, for dates and times, for a yes-or-no, for a selection from defined options, for binary content, and the relational types for connections to other records. There are field types because information is not all of one kind. A developer defining a model should choose, for each field, the field type that genuinely matches its information, since the type determines how the information is held and handled. The relational field types matter especially. For how we approach Odoo, see our ERP practice.

All posts

Got a Topic Worth Posting?

Suggest a Topic

If a question keeps coming up in your operations, it might be worth its own post.