Search 1.9 billion lines of Odoo code on GitHub

base_time_dependent_parameter

Author: Nimarosa, Odoo Community Association (OCA)
License: AGPL-3
Branch: 14.0
Repository: acsone/server-tools
Dependencies: base
Languages: HTML (357, 56.7%), Python (104, 16.5%), XML (92, 14.6%), and reStructuredText (77, 12.2%)
Other repositories: Change2improve/server-tools, Digital5-Odoo/server-tools, LevelPrime/server-tools, OCA/server-tools, StefanRijnhart/server-tools, Tecnativa/server-tools, Vauxoo/server-tools, akretion/server-tools, anhvu-sg/server-tools, blooparksystems/server-tools, brain-tec/server-tools, camptocamp/server-tools, modoolar/server-tools, sunflowerit/server-tools, tafaRU/server-tools, trevi-software/server-tools, and ursais/server-tools

<h1 class="title">Time Dependent Parameter</h1> <p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/server-tools/tree/14.0/base_time_dependent_parameter"><img alt="OCA/server-tools" src="https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/server-tools-14-0/server-tools-14-0-base_time_dependent_parameter"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/149/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p> <p>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.</p> <p>TODO: Write tests.</p> <p><strong>Table of contents</strong></p> <div class="contents local topic" id="contents"> <ul class="simple"> <li><a class="reference internal" href="#usage" id="id1">Usage</a></li> <li><a class="reference internal" href="#bug-tracker" id="id2">Bug Tracker</a></li> <li><a class="reference internal" href="#credits" id="id3">Credits</a><ul> <li><a class="reference internal" href="#authors" id="id4">Authors</a></li> <li><a class="reference internal" href="#contributors" id="id5">Contributors</a></li> <li><a class="reference internal" href="#maintainers" id="id6">Maintainers</a></li> </ul> </li> </ul> </div> <a name="usage"></a> <h2><a class="toc-backref" href="#id1">Usage</a></h2> <p>First give your user the access right &quot;Manage Time Parameters&quot;. Then you can create new parameters in &quot;Settings/Technical/Time Dependent Parameters&quot;.</p> <p>The parameters need a code and a description (which is optional). Then you can create new versions of this parameters when you define a &quot;from_date&quot; and a value.</p> <p>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 (<a class="reference external" href="https://github.com/apps2grow/apps/tree/14.0/account_tax_python_with_date">https://github.com/apps2grow/apps/tree/14.0/account_tax_python_with_date</a>) tax_rate = float(company.get_time_dependent_parameter('tax_high_rate', tax_date))</p> <p>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.</p> <p>Note: You can see a usage case of this module in OCA Payroll Module. More information in this PR: <a class="reference external" href="https://github.com/OCA/payroll/pull/31">https://github.com/OCA/payroll/pull/31</a></p> <a name="bug-tracker"></a> <h2><a class="toc-backref" href="#id2">Bug Tracker</a></h2> <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-tools/issues">GitHub Issues</a>. 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 <a class="reference external" href="https://github.com/OCA/server-tools/issues/new?body=module:%20base_time_dependent_parameter%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p> <p>Do not contact contributors directly about support or help with technical issues.</p> <a name="credits"></a> <h2><a class="toc-backref" href="#id3">Credits</a></h2> <a name="authors"></a> <h3><a class="toc-backref" href="#id4">Authors</a></h3> <ul class="simple"> <li>Nimarosa</li> </ul> <a name="contributors"></a> <h3><a class="toc-backref" href="#id5">Contributors</a></h3> <ul class="simple"> <li>Nimarosa (Nicolas Rodriguez) &lt;<a class="reference external" href="mailto:nicolasrsande&#64;gmail.com">nicolasrsande&#64;gmail.com</a>&gt;</li> <li>appstogrow (Henrik Norlin) &lt;<a class="reference external" href="mailto:henrik&#64;appstogrow.co">henrik&#64;appstogrow.co</a>&gt;</li> </ul> <a name="maintainers"></a> <h3><a class="toc-backref" href="#id6">Maintainers</a></h3> <p>This module is maintained by the OCA.</p> <a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a> <p>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.</p> <p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainers</a>:</p> <p><a class="reference external" href="https://github.com/appstogrow"><img alt="appstogrow" src="https://github.com/appstogrow.png?size=40px" /></a> <a class="reference external" href="https://github.com/nimarosa"><img alt="nimarosa" src="https://github.com/nimarosa.png?size=40px" /></a></p> <p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-tools/tree/14.0/base_time_dependent_parameter">OCA/server-tools</a> project on GitHub.</p> <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>