Add Custom Fields to Configuration Settings in Odoo 17

January 11, 2024

We will discuss how users can add new settings and carry out related operations to tailor Odoo’s Settings menu to their unique business requirements in this blog post.

It is possible to add a discount limit feature for sale orders in Odoo by developing a custom module called “sale_discount_limit.” In Odoo’s settings, users will be able to enable or disable this functionality. Users can choose to set a discount limit as needed once the feature is activated.

1. Expand the “res.config.settings” model with new fields.

Since Odoo’s Res Config Settings model is transient, its data is routinely cleaned up. To ensure the preservation and retrieval of field data, incorporate the ‘config_parameter’ attribute in the field definition. Configuration is achieved through the following setup.


Once the ‘config_parameter’ is established, retrieving field values in the settings becomes efficient. Two fields have been introduced in this context: “discount_limit,” represented by a float field, and “is_discount_limit,” represented by a boolean field.


2. Enhance the “res.config.settings” view with a custom view.

When adding custom fields to an existing view in Odoo 17, you can use the <xpath> tag to specify the custom fields’ position. To add custom fields to the sale settings, you should inherit the viewable.res_config_settings_view_form’ and specify where you want these fields to appear. Odoo 17 added a new feature known as the settings> tag. For greater convenience and customization flexibility, Odoo automatically aligns the fields to the left and right using the <settings> tag. Because it contains automatically left-aligned boolean fields and has attributes that let you customize where they go, adding this tag makes adding these fields easier.

The field can have a unique ID, which is useful for locating it during inheritance. If the field label is not specified, the string is used as the visible heading. By including a brief description in the help attribute, users can gain access to more information under the heading. Furthermore, when users hover their mouse over a field, the title attribute assists in explaining what the field is used for. You can incorporate documentation by designating a documentation path, giving users access to more information when they click the question mark next to the field.


incorporated a custom field into the ‘Pricing’ section of the sale settings, strategically placing it following the sale order line discount field.

This newly added field is configured to be visible exclusively when the line discount option is activated.

The initial image displays the disabled discount feature, resulting in the absence of the discount limit activation option. Conversely, in the subsequent image, users gain the ability to view the discount limit option after enabling the discount, providing them with the flexibility to decide whether to activate it or not.


Upon enabling the discount limit, users can input their preferred value in this field. Accessing the documentation is facilitated by hovering the mouse over the question mark and clicking it, redirecting users to the pertinent information.


This configuration makes it entirely possible to establish conditions or carry out actions based on the values of these fields, thereby allowing the creation of personalized setting options within the Res Configuration Settings in Odoo.

"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 *