Available Fields in Odoo – A Complete Guide

Odoo is a powerful and flexible ERP platform built on a robust object-relational mapping (ORM) layer. At the heart of every model (models.Model) in Odoo are fields. they define the structure of the data, how it is stored, displayed, and interacted with. Whether you're customising  existing modules or building new ones, understanding Odoo field types is essential.

In this blog, we’ll walk through all the available field types in Odoo, explain how they work, and provide real-world usage examples.


A field in Odoo defines a column in the database and a corresponding element in the user interface. Fields control:

  • The type of data stored (e.g., text, number, date)
  • The behavior of the field (read-only, computed, default)
  • How the field appears in views and forms


1. Basic Field Types

These fields handle standard data types like strings, numbers, and dates.

Field TypeDescriptionExample
CharSingle-line textfields.Char(string="Name")
TextMulti-line textfields.Text(string="Description")
BooleanCheckbox (True/False)fields.Boolean(string="Is Active")
IntegerWhole numberfields.Integer(string="Quantity")
FloatDecimal numberfields.Float(string="Weight")
DateDate onlyfields.Date(string="Start Date")
DatetimeDate and timefields.Datetime(string="Created On")
SelectionDropdown optionsfields.Selection([ ('draft', 'Draft'), ('done', 'Done') ], string="Status")


2. Relational Fields

These fields are used to create links between different models. Refer  the video  for complete demo


Many2one

Used to select a single record from another model (foreign key).

partner_id = fields.Many2one('res.partner', string="Customer")

One2many

Used to link one record to multiple records in another model.

order_line_ids = fields.One2many('sale.order.line', 'order_id', string="Order Lines")

Many2many

Used to create a many-to-many relationship between records.

tag_ids = fields.Many2many('crm.tag', string="Tags")

3. Computed Fields

Computed fields are automatically calculated using Python logic. Find below video for full demo.



total = fields.Float(string="Total", compute="_compute_total") @api.depends('price', 'quantity') def _compute_total(self): for rec in self: rec.total = rec.price * rec.quantity

Add store=True if you want the value saved in the database.

4. Related Fields

These fields fetch values from a related model.

customer_email = fields.Char(related='partner_id.email', string="Email", store=True)

Useful for referencing fields from related models directly in your current model.

5. Other Special Fields

FieldUse Case
HtmlStore rich text content
BinaryUpload and store files (PDF, Excel, etc.)
ImageStore and resize images
MonetaryFloat with currency support
ReferenceDynamically refer to any model
SerializedStore JSON data (technical use only)

Example:

document = fields.Binary(string="Upload Document") price = fields.Monetary(string="Price", currency_field='currency_id')

6. Common Field Attributes

You can enhance fields using several attributes. Please find below video for full demo


AttributePurpose
stringDisplay label
required=TrueMake field mandatory
readonly=TrueMake field read-only
default=Set default value
help=Tooltip explanation
index=TrueIndex the field in the database
copy=FalseDo not copy value when duplicating
groups=Restrict visibility based on user group

Example:


price = fields.Float( string="Unit Price", required=True, default=0.0, help="The default selling price", copy=False )

7. Full Example: Defining a Product Model


class CustomProduct(models.Model): _name = 'custom.product' _description = 'Custom Product' name = fields.Char(string="Product Name", required=True) description = fields.Text(string="Description") price = fields.Float(string="Price") available = fields.Boolean(string="Available") category_id = fields.Many2one('product.category', string="Category") image = fields.Image(string="Product Image") total_stock = fields.Float(string="Total Stock", compute='_compute_total_stock', store=True) @api.depends('stock_line_ids.quantity') def _compute_total_stock(self): for rec in self: rec.total_stock = sum(line.quantity for line in rec.stock_line_ids)


Odoo fields are the core of any model or business logic. By mastering the various field types and their usage, you can build powerful, user-friendly modules that make full use of the Odoo framework. From basic data entry to complex relational logic, Odoo’s fields provide everything you need to create robust applications.

Share this post
Tags
Archive
Lets Start Odoo Module Development