Skip to main content

Time dependent parameters Adds the feature to define parameters with time based versions.

Project description

Beta License: LGPL-3 OCA/server-tools Translate me on Weblate Try me on Runbot

This module adds support for time dependent parameters. It doesn’t provide any additional functionality when installed alone. You should use it in the developing of other modules which might favor of the functionality provided. It allows you to get time dependent parameters from any model in Odoo. The functionality is useful for cases when you have static parameters values which changes depending of the date of the record or todays date.

Table of contents

Usage

First give your user the access right “Manage Time Parameters”. Then in “Settings/Technical/Time Parameters” you can create a new parameter with different versions (start date and value).

Then you can access current parameter value like this: .. code-block:: python

# using today’s date when no date is passed value = model.get_time_parameter(‘my_parameter_name’) # hr.payslip: use payslip.date_to value = payslip.get_time_parameter(‘my_parameter_name’, payslip.date_to) # account.tax: use tax_date (https://github.com/apps2grow/apps/tree/14.0/account_tax_python_with_date) tax_rate = float(company.get_time_parameter(‘tax_high_rate’, tax_date))

Payroll implementation: * Payroll configuration only shows payslip parameters. * By default, the model_id field is hidden in the form. * Only payslip model/record may call time_parameter(code).

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

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed feedback.

Do not contact contributors directly about support or help with technical issues.

Credits

Authors

  • Nimarosa

  • appstogrow

Contributors

Maintainers

This module is maintained by the OCA.

Odoo Community Association

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

Current maintainers:

appstogrow nimarosa

This module is part of the OCA/server-tools project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page