Skip to content

Latest commit

 

History

History
 
 

base_time_dependent_parameter

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Time Dependent Parameter

Beta License: AGPL-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.

TODO: Write tests.

Table of contents

First give your user the access right "Manage Time Parameters". Then you can create new parameters in "Settings/Technical/Time Dependent Parameters".

The parameters need a code and a description (which is optional). Then you can create new versions of this parameters when you define a "from_date" and a 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_dependent_parameter('my_parameter_name') # hr.payslip: use payslip.date_to value = payslip.get_time_dependent_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_dependent_parameter('tax_high_rate', tax_date))

Finally i recomend that if you use this parameters in another modules, you create a view which filter by module_name so you can have a view for each module that needs to change this parameters and the user can only view the parameters of the module that he is looking to change.

Note: You can see a usage case of this module in OCA Payroll Module. More information in this PR: OCA/payroll#31

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.

  • Nimarosa

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.