How to Set Up & Use System Parameters in Odoo 18
By Braincuber Team
Published on February 5, 2026
Every growing business eventually faces the need to tweak its ERP system's core behavior without rewriting the source code. Whether it's locking down the base URL for a multi-domain setup or defining a global API timeout threshold, System Parameters in Odoo 18 are your best friend.
In this guide, we'll explore how RetailChain Inc. uses System Parameters to enforce globally consistent password policies and manage their multi-brand e-commerce domains. You'll learn how to create these parameters via the UI and XML, and how to access them dynamically using Python.
What You'll Master:
- Configuration: Creating parameters via UI vs. XML modules.
- Development: Reading and writing parameters in Python code.
- Stability: Freezing the
web.base.urlfor production environments.
Method 1: The User Interface Approach
For quick changes or on-the-fly configuration (like temporarily enabling a maintenance mode flag), the UI is the fastest route.
- Activate Developer Mode (Settings > General Settings).
- Navigate to Settings > Technical > Parameters > System Parameters.
- Click New and define your key-value pair.
Example: RetailChain Global Policy
Any developer can now access this '15.0' limit from anywhere in the codebase without hardcoding it.
Method 2: Defining in Modules (XML)
For permanent configurations that should be deployed across all environments (Staging, Production), define them in your custom module's data file.
<odoo>
<data noupdate="1">
<!-- Minimum password length for customer accounts -->
<record id="auth_signup.password_minlength" model="ir.config_parameter">
<field name="key">auth_password_minlength</field>
<field name="value">12</field>
</record>
<!-- Custom API Timeout for internal services -->
<record id="parameter_api_timeout" model="ir.config_parameter">
<field name="key">retail.internal_api_timeout</field>
<field name="value">30</field>
</record>
</data>
</odoo>
Accessing Parameters in Python
Once your parameters are set, you need to use them in your business logic. Here is how you can retrieve and update them programmatically.
def check_discount_policy(self):
# Retrieve the parameter
# NOTE: get_param ALWAYS returns a string!
limit_str = self.env['ir.config_parameter'].sudo().get_param('retail.global_discount_limit', default='0')
# Always cast the type safely
limit = float(limit_str)
if self.discount > limit:
raise ValidationError(f"Discount cannot exceed global limit of {limit}%")
def set_new_timeout(self, seconds):
# Update or create a parameter
self.env['ir.config_parameter'].sudo().set_param('retail.internal_api_timeout', str(seconds))
Critical Tip: Freezing the URL
Odoo automatically updates the web.base.url parameter based on the administrator's latest login domain. In production, this can break email links if an admin logs in via a localhost tunnel or an internal IP.
To prevent this, enable the "Freeze" parameter:
Conclusion
System parameters separate your configuration from your code, making your Odoo modules cleaner, more portable, and easier to manage across different environments. Whether you are enforcing security policies or managing global variables for RetailChain Inc., mastering ir.config_parameter is a fundamental skill for any Odoo developer.
Master Odoo Configuration
Need to build complex, configurable Odoo modules that scale? Our developers can help you architect robust solutions.
