Overview of Odoo 20 Field Parameters

November 12, 2026 by
Overview of Odoo 20 Field Parameters
Mevin Varghese


                                                                                                                 



Overview of Odoo 20 Field Parameters

Introduction
Odoo 20 provides various field parameters that allow developers to customize field behavior, validation, visibility, tracking, and data storage. This article explores the most commonly used field parameters and how they help build flexible and user-friendly applications.
What are Field Parameters ?
Field parameters are optional attributes used when defining fields in an Odoo model. They control how a field behaves, how it is displayed, and how its data is managed.
Consider the following example:
name = fields.Char(
    string="Employee Name",
    required=True,
    copy=False,
    tracking=True,
)

In this field definition:
  • string defines the field label.
  • required makes the field mandatory.
  • copy controls whether the value is copied when duplicating a record.
  • tracking tracks field changes in the chatter.
Field parameters help developers customize field behavior, enforce business rules, improve user experience, and manage data efficiently. They are an essential part of Odoo model development.
Basic Field Parameters
Basic field parameters control common field properties such as labels, required values, default values, and help text. They are among the most frequently used parameters in Odoo development.

string: The string parameter defines the field label displayed to users in the Odoo interface. It makes field names more readable and user-friendly.
Example:
name = fields.Char(string="Employee Name")

Here, the field appears with the label Employee Name instead of using the technical field name name.
required: The required parameter specifies whether a field must have a value.
Example:
name = fields.Char(
    string="Employee Name",
    required=True,
)

Here, required=True makes the field mandatory. Odoo enforces this requirement during normal record creation and updates, including at the ORM level.


readonly: The readonly parameter prevents users from editing a field through the interface.
Example:
reference = fields.Char(
    string="Reference",
    readonly=True,
)

The field value can be viewed but not modified by users.

default:The default parameter assigns an initial value when a record is created.
Example:
state = fields.Selection(
    [
        ('draft', 'Draft'),
        ('confirmed', 'Confirmed'),
    ],
    string="Status",
    default='draft',
)

New records will have the Draft status by default.

help: The help parameter displays additional information as a tooltip.
Example:
email = fields.Char(
    help="Enter the employee's email address."
)

This helps users understand what value should be entered.

copy: The copy parameter determines whether a field value is duplicated when a record is copied.
Example:
reference = fields.Char(
    copy=False
)

The field value will not be copied to the new record.

index: The index parameter creates a database index to improve search performance.
Example:
employee_code = fields.Char(
    index=True
)

This is useful for fields that are frequently searched or filtered.

Computed Field Parameters
Computed field parameters are used to calculate field values dynamically instead of storing values directly in the database. These parameters help automate calculations, derive values from other fields, and customize how computed fields behave.

compute: The compute parameter specifies the method used to calculate a field's value.
Example:
total_amount = fields.Float(
    compute="_compute_total_amount"
)

@api.depends('line_ids.amount')
def _compute_total_amount(self):
    for rec in self:
        rec.total_amount = sum(
            rec.line_ids.mapped('amount')
        )
The field value is automatically calculated by the specified method.

store: The store parameter determines whether a computed field is stored in the database.
Example:
total_amount = fields.Float(
    compute="_compute_total_amount",
    store=True
)
When store=True, the computed value is saved in the database and can be searched more efficiently.

inverse: The inverse parameter allows users to edit a computed field by defining a method that updates the underlying data.
Example:
amount = fields.Float(
    compute="_compute_amount",
    inverse="_inverse_amount"
)
The inverse method is called when the user modifies the computed value.

search: The search parameter defines custom search behavior for computed fields.
Example:
full_name = fields.Char(
    compute="_compute_full_name",
    search="_search_full_name"
)
This allows non-stored computed fields to be searchable.

compute_sudo: The compute_sudo parameter executes the compute method with superuser privileges.
Example:
total_sales = fields.Float(
    compute="_compute_total_sales",
    compute_sudo=True
)
This is useful when the computation requires access to restricted records.

precompute: The precompute parameter computes a value before the record is inserted into the database.
Example: 
sequence = fields.Integer(
    compute="_compute_sequence",
    precompute=True
)
This ensures the value is available during record creation.

recursive: The recursive parameter is used when a computed field depends on itself through hierarchical relationships.
Example:
parent_total = fields.Float(
    compute="_compute_parent_total",
    recursive=True
)
This allows Odoo to correctly handle recursive computations.

Relational Field Parameters
Relational field parameters define how records are linked between models and how those relationships behave.
Many2one Parameters
related: Creates a field that automatically mirrors the value of another field.
Example:
partner_email = fields.Char(
    related="partner_id.email"
)
The field displays the email of the selected partner.

domain: Filters the records available for selection.
partner_id = fields.Many2one(
    'res.partner',
    domain=[('customer_rank', '>', 0)]
)

context: Passes additional context to the field.
Example:
partner_id = fields.Many2one(
    'res.partner',
    context={'show_vat': True}
)

ondelete: Defines what happens when the related record is deleted.
department_id = fields.Many2one(
    'hr.department',
    ondelete='restrict'
)
Common values are restrict, cascade, and set null.

auto_join:Automatically performs SQL joins during searches.
partner_id = fields.Many2one(
    'res.partner',
    auto_join=True
)

delegate: Exposes fields from the related model in the current model.
Example:
partner_id = fields.Many2one(
    'res.partner',
    delegate=True
)

check_company: Ensures company consistency between related records.
partner_id = fields.Many2one(
    'res.partner',
    check_company=True
)
Helps prevent cross-company data issues.
One2many Parameters
comodel_name: Specifies the related model.
inverse_name: Specifies the field that links back to the current model.
Example:
line_ids = fields.One2many(
  comodel_name= 'sale.order.line',
    inverse_name='order_id'
)


Many2many Parameters
relation: Defines the intermediate relation table.
column1: Defines the first foreign key column in the relation table.
column2: Defines the second foreign key column in the relation table.
Example:
tag_ids = fields.Many2many(
    'project.tags',
    relation='project_task_tag_rel',
    column1='task_id',
    column2='tag_id'
)
Security and Access Parameters

groups:The groups parameter restricts field access to specific user groups.
Example:
salary = fields.Float(
    groups="hr.group_hr_manager"
)
Only users belonging to the specified group can view or edit the field.

tracking: The tracking parameter logs field changes in the chatter.
Example:
name = fields.Char(
    tracking=True
)
Changes to the field are automatically recorded in the record's chatter.

company_dependent:The company_dependent parameter stores different values for each company.
Example:
property_account_id = fields.Many2one(
    'account.account',
    company_dependent=True
)
Selection Field Parameters
selection: The selection parameter defines the available choices for a Selection field. It can be specified as a list of (value, label) pairs, a model method, or a method name that returns the available options.

selection_add: The selection_add parameter adds new options to an existing Selection field.
Example:
state = fields.Selection(
    selection_add=[
        ('approved', 'Approved')
    ]
)
Commonly used when extending standard Odoo modules.

ondelete (with selection_add): Defines the action performed when an added selection value is removed.
Example:
state = fields.Selection(
    selection_add=[
        ('approved', 'Approved')
    ],
    ondelete={
        'approved': 'set default'
    }
)
Helps manage records that use the custom selection value.
Field-Type Specific Parameters
String Field Parameter
size: The size parameter specifies the maximum length allowed for a Char field.
Example:
employee_code = fields.Char(
    size=10
)

trim: The trim parameter automatically removes leading and trailing whitespace from field values.
Example:
name = fields.Char(
    trim=True
)

translate: The translate parameter allows field values to be translated into multiple languages.
Example:
description = fields.Text(
    translate=True
)
Useful for multilingual applications and websites.
Float Field Parameter
digits: The digits parameter defines the decimal precision of a Float field.
Example:
price = fields.Float(
    digits=(16, 2)
)
Monetary Field Parameters
currency_field: The currency_field parameter specifies the field that contains the currency for a Monetary field.
Example:

currency_id = fields.Many2one(
    'res.currency',
    string="Currency"
)

amount = fields.Monetary(
    currency_field='currency_id'
)
Binary Field Parameters
attachment: The attachment parameter determines whether binary data is stored as an attachment.
Example:
document = fields.Binary(
    attachment=True
)
This is commonly used for uploaded files such as documents and images.
Image Field Parameters
Image fields inherit from Binary fields and provide additional image-specific parameters.

max_width: Limits the maximum width of uploaded images.
max_height: Limits the maximum height of uploaded images.
verify_resolution: Validates the image resolution during upload.
Example:
image = fields.Image(
    max_width=1024,
    max_height=1024,
    verify_resolution=True
)
HTML Field Parameters
HTML field parameters help control and sanitize HTML content.

sanitize:Removes unsafe HTML content.
sanitize_attributes:Controls sanitization of HTML attributes.
sanitize_form: Controls sanitization of form-related elements.
sanitize_style: Controls sanitization of CSS styles.
strip_style: Removes style information from HTML content.
strip_classes: Removes CSS classes from HTML content.
Example:
description = fields.Html(
    sanitize=True,
    sanitize_attributes=True,
    sanitize_style=True,
    strip_style=False,
    strip_classes=False
)

Conclusion
Field parameters are essential for controlling how fields behave in Odoo 20. They help developers manage validation, data storage, relationships, security, and user experience. By understanding and using these parameters effectively, you can build more flexible, maintainable, and efficient Odoo applications

If you are looking for an ERP implementation partner with diverse industry experience feel free to contact us. We have proven track record of successful implementations across various sectors including Odoo for Manufacturing, Odoo for Trading, Odoo for FMCG, Odoo for Oil & Gas, Odoo for Diary, Odoo for Pharma, Odoo for Cosmetic Clinic, Odoo for Contracting Companies, Odoo for HVAC, Odoo for Logistics, Odoo for Automobile, Odoo for Laundry, Odoo for Field Service, Odoo for E-Commerce &
many more


ZestyBeanz offers Developer / Consultant outsourcing programs, Chat with us in Whatsapp and Hire Odoo Developers, Mobile Application Developers, Consultants.
#OdooKerala #OdooKochi #OdooTrivandrum #OdooERP #ProjectManagement #OdooVansales #HireOdooDeveloper#Odoo19 #OdooTimeOff #LeaveManagement #HRManagement #OdooHR #EmployeeManagement #OdooERP #PublicHolidays #MandatoryDays #ZestyBeanz