Author: |
Nimarosa, appstogrow, Odoo Community Association (OCA) |
License: |
LGPL-3 |
Branch: |
162_14.0_oca |
Repository: |
Digital5-Odoo/server-tools |
Dependencies: |
base |
Languages: |
HTML (378, 48.6%),
Python (221, 28.4%),
XML (118, 15.2%),
and
reStructuredText (60, 7.7%) |
Other branches: |
101_14.0_oca,
134_14.0_oca,
152_14.0_oca,
161_14.0_oca,
164_14.0_oca,
166_14.0_oca,
167_14.0_oca,
168_14.0_oca,
169_14.0_oca,
176_14.0_oca,
177_14.0_oca,
178_14.0_oca,
179_14.0_oca,
180_14.0_oca,
936_14.0_oca,
TSG_mrp_d5_14.0_oca,
and
base_14.0_oca |
Other repositories: |
AITIC/server-tools,
Change2improve/server-tools,
ForgeFlow/server-tools,
Jarsa/server-tools,
LevelPrime/server-tools,
OCA/server-tools,
Rad0van/server-tools,
StefanRijnhart/server-tools,
acsone/server-tools,
akretion/server-tools,
aurestic/server-tools,
brain-tec/server-tools,
camptocamp/server-tools,
coopiteasy/server-tools,
grindtildeath/server-tools,
gurneyalex/server-tools,
kmee/server-tools,
legalsylvain/server-tools,
modoolar/server-tools,
petrus-v/server-tools,
sunflowerit/server-tools,
tegin/server-tools,
and
zarumaru/server-tools |
<h1 class="title">Time 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/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/server-tools/tree/14.0/base_time_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_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><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 "Manage Time Parameters".
Then in "Settings/Technical/Time Parameters" you can create a new parameter
with different versions (start date and value).</p>
<p>Then you can access current parameter value like this:
.. code-block:: python</p>
<blockquote>
# 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 (<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_parameter('tax_high_rate', tax_date))</blockquote>
<p>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).</p>
<pre>
<code lang="XML"><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"
/></code>
</pre>
<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_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>
<li>appstogrow</li>
</ul>
<a name="contributors"></a>
<h3><a class="toc-backref" href="#id5">Contributors</a></h3>
<ul class="simple">
<li>Nimarosa (Nicolas Rodriguez) <<a class="reference external" href="mailto:nicolasrsande@gmail.com">nicolasrsande@gmail.com</a>></li>
<li>appstogrow (Henrik Norlin) <<a class="reference external" href="mailto:henrik@appstogrow.co">henrik@appstogrow.co</a>></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_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>