Types Of Odoo18 Field Parameters

FAYIS
May 10, 2025
odoo18-field-parameters

Odoo is an example of open-source business management software which comes with a plethora of tools and features capable of optimizing and customizing various aspects of your business. One such field is known as a field parameter, which allows you to dictate how your business data is stored, viewed, and processed within the business system.

In this blog entry, we will review Odoo18 and its core features along with how field parameters can control the behavior of an Odoo field on a particular model. In Odoo18, field parameters are defined as specific characteristics of a field within your models. These characteristics determine how the user interface of a particular system will display a concept, how the item will be saved in the database, and many more. Let’s explore the basic field parameters alongside their roles.

String

String is a parameter which defines the title of a label for a particular field, which is considered relatively human readable. If a mark is not proved by the user within the models, Odoo takes the liberty of assigning the name of the field as its title.

Illustration:

name = fields.Char(string="Name of the field")       


                                    

Translate

Designating Translate as True allows the field to be translatable into different languages, which is important for multilingual applications.

Illustration:

name = fields.Char(string="Name", translate=True)

Readonly

Making Readonly True will set the field as non-editable. Users will not be able to make any edits. This parameter is False by default.

Illustration:

name = fields.Char(string="Name", readonly=True)

Required

When set to True, the Required parameter enforces a restriction on the field, meaning it becomes compulsory to fill in.

Illustration:

name = fields.Char(string="Field name", required=True)

Store

The Store parameter indicates if the field is to be kept in the database. As a Rule of Thumb, most fields are stored in the database, with the exception of computed fields.

Copy

This parameter describes the copy behavior of the value for a field after a record is copied. For most ordinary fields, this value will be True. It is set to False for a limited number of special fields.

Groups

With the Groups parameter field can be assigned to certain user groups and thus access can be limited to those users enhancing security and access control capability of the system.

Illustration:

name = fields.Char(string='Name', groups="base.group_user")

Index

Indexing is one of the steps that need to be performed to improve the performance of the database in Odoo18. An index is a pointer that enables speed up searches on data to be done through references instead scan the entire data. Lets check some of the points that deal with indexing:

The default index used by Odoo for Many2one relationships is “btree” and this is the default value which allows for fast searching and range searching.

Illustration:

field_name = fields.Many2one('model.name', index=True)
“btreenotnull” – same applies to “btree,” but this time ignoring NULL values.

Illustration:

fieldname = fields.Char(index = “btreenot_null”)

“gin” or “trigram” – Generalized Inverted Indexing (GIN) paired with trigrams is employed for full-text search.

Illustration:

field_name = fields.Text(index = “gin”)

False or None – signifies that no index is wanted.

Illustration:

field_name = fields.Integer(index=False)

Default sets the parameter to a particular pre-defined value which the field will possess, irrespective of it being ascribed directly or through certain logic in a function.

States

States enable you to control what actions a field can take and whether it is visible or not based on the state of the record.

Illustration:

state_field = fields.Selection([('draft', 'Draft'), ('confirmed', 'Confirmed'), ('done', 'Done')], string='State', default='draft', states={'confirmed': [('readonly', True)], 'done': [('readonly', True)]})

Compute

Computed fields utilize other fields or defined logic in Python to offer their values. The attribute “compute” holds all these, while “precompute,” “recursive,” “inverse,” “search,” and “related” refine more intricate setups.

Selection

This parameter sets a set of possible values for a given field in the form of tuples (value, label), as a model method, or the name of a method.

Selection_add

In the case of an overridden field, selection_add permits you to modify an existing selection by appending additional options relative to the order provided while preserving the original values.

Ondelete

The Ondelete parameter provide methods in charge of value’s fallback policy during deletion for the overridden fields with Selection_add. Policy are: ‘set null’, ‘cascade’, ‘set default’, ‘set VALUE’, ‘callable’ or user defined function.

Field parameters in Odoo18 give a lot of possibility with regard to the management of your data. Through these parameters, you can modify your Odoo application to better fit the requirements of your business.Odoo field parameters control visibility, boost database performance and ensure data integrity. All these objectives can be achieved because of the flexibility provided by Odoo’s field parameters. For Odoo developers and administrators, applying and understanding Odoo parameters is essential for configuring and customizing Odoo applications.

Knowing these important field parameters in Odoo18, you are now empowered to develop more sophisticated and tailored applications that address your business needs.

Take your business further with Odoo18. Get a free consultation and discover how with Bassam Infotech today.

"Unlock the Full Potential of Your Business with Odoo ERP!"

"Get a Cost Estimate for Your ERP Project, Absolutely FREE!"

Get a Free Quote

Leave a Reply

Your email address will not be published. Required fields are marked *