OdooWiki OCA HUB

Time Parameter

base_time_parameter folder_open OCA/server-tools open_in_new
Technical License: LGPL-3

A value may change over time. With this module you may set starting dates and values.

auto_awesome What this module does

AI-generated from the code · Odoo 18.0

Lets you store values that change over time (rates, thresholds, flags) and read the right value for any given date. Access is through a new Time Parameters menu under Technical settings.

This module adds a central place to keep values that are not fixed: a rate, a limit, a yes/no flag or a text that changes on specific dates. Each parameter has a name, a code, a type (boolean, date, float, integer, JSON, record or text), an optional company, country and model, and a list of versions. Each version has a start date and a value, so the system always knows which value applies on a given day.

Where it appears: - A new "Time Parameters" menu under the Technical settings area, with list and form screens. - On a parameter form, a Versions list where you enter start dates and values directly. - A "Versions" action available from the parameter screen.

Business rules and automatic behaviour: - A parameter code must be unique per company; two versions of the same parameter cannot start on the same day. - Values are automatically cleaned when typed: dates are reformatted, numbers converted, JSON checked, booleans normalised. - When a value is requested for a date, the most recent version starting on or before that date is used. - Multi-company rules restrict parameters and versions to the companies the user can access. - A helper method get_time_parameter is added to all models so other modules can ask for a parameter value by code and date.

It touches base.time.parameter, base.time.parameter.version and extends the base model.

Depends on

base

Required by other modules

Menus it adds

Time Parameters
Models and fields (3)
  • base · extends an existing model
  • base.time.parameter · new modelcode, name (Parameter Name), type, model_id (Model), company_id (Company), country_id (Country), description, version_ids (Versions), record_model
  • base.time.parameter.version · new modelcode, type, value, date_from, company_id, country_id, parameter_id (Time Parameter), value_reference (Reference Value)

Text generated by AI (DeepSeek) from reading the Odoo 18.0 code on GitHub; it may contain mistakes, so check the code before deciding. View the code on GitHub

Availability by version

Reviewed: 2026-11-03
Confirmed (verified in repository and branch) Estimated (unverified) No information

Confirmation status: 3 confirmed, 6 with no information of 9 versions.

Sources · Odoo 18.0

Confirmed on 2026-11-03 in branch 18.0 of OCA/server-tools.

terminal Installation and usage

OCA documentation · Odoo 18.0

The user needs the access right "Manage Time Parameters".

Menu: "Settings/Technical/Time Parameters"

Create a parameter with different versions (start date and value).

If model_id is empty, any model/record may get the time parameter.

The value may be a text or reference.

Get the value like this:

# Pass no date: using today's date
value = model.get_time_parameter("parameter_code_or_name")
# Pass a date or datetime
value = model.get_time_parameter("parameter_code_or_name", date=datetime.datetime.now()))
# Pass the name of a date/datetime field of the record
value = record.get_time_parameter("parameter_code_or_name", "date")

Example of implementation in another module

Payroll implementation:

  • Menu "Payroll/Configuration/Time Parameters" only shows hr.payslip parameters.
  • New parameters will be hr.payslip parameters.
  • By default, the model_id field is hidden in the form.
<record id="base_time_parameter_action" model="ir.actions.act_window">
    <field name="name">Time Parameters</field>
    <field name="res_model">base.time.parameter</field>
    <field name="view_mode">tree,form</field>
    <field
        name="domain"
        eval="[('model_id', '=', ref('payroll.model_hr_payslip'))]"
    />
    <field
        name="context"
        eval="{'default_model_id': ref('payroll.model_hr_payslip')}"
    />
</record>
<menuitem
    id="menu_action_base_time_parameter"
    action="base_time_parameter_action"
    name="Time Parameters"
    parent="payroll_menu_configuration"
    sequence="35"
/>

Reference field implementatiton:

from odoo import fields, models


class TimeParameterVersion(models.Model):
    _inherit = "base.time.parameter.version"

    value_reference = fields.Reference(
        selection_add=[("account.account", "Account")],
    )

No verified information in OCA: Installation.

info

Data imported from GitHub: this sheet reflects the latest catalog review, not a live lookup. Always check the module documentation and staging before installing in production.