Author: |
Nimarosa, appstogrow, Odoo Community Association (OCA) |
License: |
LGPL-3 |
Branch: |
TSG_mrp_d5_14.0_oca |
Repository: |
Digital5-Odoo/server-tools |
Dependencies: |
base |
Languages: |
HTML (399, 41.0%),
Python (371, 38.1%),
XML (135, 13.9%),
and
reStructuredText (68, 7.0%) |
Other branches: |
101_14.0_oca,
134_14.0_oca,
152_14.0_oca,
161_14.0_oca,
162_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,
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>A value may change over time.
With this module you may set starting dates and values.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#configuration" id="id1">Configuration</a></li>
<li><a class="reference internal" href="#usage" id="id2">Usage</a><ul>
<li><a class="reference internal" href="#example-of-implementation-in-another-module" id="id3">Example of implementation in another module</a></li>
</ul>
</li>
<li><a class="reference internal" href="#bug-tracker" id="id4">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id5">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id6">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id7">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id8">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<a name="configuration"></a>
<h2><a class="toc-backref" href="#id1">Configuration</a></h2>
<p>The user needs the access right "Manage Time Parameters".</p>
<a name="usage"></a>
<h2><a class="toc-backref" href="#id2">Usage</a></h2>
<p>Menu: "Settings/Technical/Time Parameters"</p>
<p>Create a parameter with different versions (start date and value).</p>
<p>If model_id is empty, any model/record may get the time parameter.</p>
<p>The value may be a text or reference.</p>
<p>Get the value like this:</p>
<pre>
<code lang="python"># 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")</code>
</pre>
<a name="example-of-implementation-in-another-module"></a>
<h3><a class="toc-backref" href="#id3">Example of implementation in another module</a></h3>
<p>Payroll implementation:</p>
<ul class="simple">
<li>Menu "Payroll/Configuration/Time Parameters" only shows hr.payslip parameters.</li>
<li>New parameters will be hr.payslip parameters.</li>
<li>By default, the model_id field is hidden in the form.</li>
</ul>
<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>
<p>Reference field implementatiton:</p>
<pre>
<code lang="python">from odoo import fields, models
class TimeParameterVersion(models.Model):
_inherit = "base.time.parameter.version"
value_reference = fields.Reference(
selection_add=[("account.account", "Account")],
)</code>
</pre>
<a name="bug-tracker"></a>
<h2><a class="toc-backref" href="#id4">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="#id5">Credits</a></h2>
<a name="authors"></a>
<h3><a class="toc-backref" href="#id6">Authors</a></h3>
<ul class="simple">
<li>Nimarosa</li>
<li>appstogrow</li>
</ul>
<a name="contributors"></a>
<h3><a class="toc-backref" href="#id7">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="#id8">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>