Metadata-Version: 2.1
Name: odoo14-addon-base-time-parameter
Version: 14.0.3.0.5
Summary: Time dependent parameters Adds the feature to define parameters with time based versions.
Home-page: https://github.com/OCA/server-tools
Author: Nimarosa, appstogrow, Odoo Community Association (OCA)
Author-email: support@odoo-community.org
License: LGPL-3
Platform: UNKNOWN
Classifier: Programming Language :: Python
Classifier: Framework :: Odoo
Classifier: Framework :: Odoo :: 14.0
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
Classifier: Development Status :: 4 - Beta
Requires-Python: >=3.6
Requires-Dist: odoo (<14.1dev,>=14.0a)

==============
Time Parameter
==============

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   !! This file is generated by oca-gen-addon-readme !!
   !! changes will be overwritten.                   !!
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
    :target: https://odoo-community.org/page/development-status
    :alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
    :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
    :alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github
    :target: https://github.com/OCA/server-tools/tree/14.0/base_time_parameter
    :alt: OCA/server-tools
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
    :target: https://translation.odoo-community.org/projects/server-tools-14-0/server-tools-14-0-base_time_parameter
    :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
    :target: https://runbot.odoo-community.org/runbot/149/14.0
    :alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5| 

A value may change over time.
With this module you may set starting dates and values.

**Table of contents**

.. contents::
   :local:

Configuration
=============

The user needs the access right "Manage Time Parameters".

Usage
=====

Menu: "Settings/Technical/Time Parameters"

Create a parameter with different versions (start date and value).

If model_id is empty, any model/record may get the time parameter.

The value may be a text or reference.

Get the value like this:

.. code-block:: 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")

Example of implementation in another module
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Payroll implementation:

* Menu "Payroll/Configuration/Time Parameters" only shows hr.payslip parameters.
* New parameters will be hr.payslip parameters.
* By default, the model_id field is hidden in the form.

.. code-block:: 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"
    />

Reference field implementatiton:

.. code-block:: python

    from odoo import fields, models


    class TimeParameterVersion(models.Model):
        _inherit = "base.time.parameter.version"

        value_reference = fields.Reference(
            selection_add=[("account.account", "Account")],
        )

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-tools/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 <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**>`_.

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

Credits
=======

Authors
~~~~~~~

* Nimarosa
* appstogrow

Contributors
~~~~~~~~~~~~

* Nimarosa (Nicolas Rodriguez) <nicolasrsande@gmail.com>
* appstogrow (Henrik Norlin) <henrik@appstogrow.co>

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
   :alt: Odoo Community Association
   :target: https://odoo-community.org

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.

.. |maintainer-appstogrow| image:: https://github.com/appstogrow.png?size=40px
    :target: https://github.com/appstogrow
    :alt: appstogrow
.. |maintainer-nimarosa| image:: https://github.com/nimarosa.png?size=40px
    :target: https://github.com/nimarosa
    :alt: nimarosa

Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-appstogrow| |maintainer-nimarosa| 

This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/14.0/base_time_parameter>`_ project on GitHub.

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


