Metadata-Version: 2.1
Name: odoo-addon-base_time_parameter
Version: 18.0.1.0.0.2
Requires-Python: >=3.10
Requires-Dist: odoo==18.0.*
Summary: Time dependent parameters Adds the feature to define parameters with time based versions.
Home-page: https://github.com/OCA/server-tools
License: LGPL-3
Author: Nimarosa, appstogrow, Odoo Community Association (OCA)
Author-email: support@odoo-community.org
Classifier: Programming Language :: Python
Classifier: Framework :: Odoo
Classifier: Framework :: Odoo :: 18.0
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
Classifier: Development Status :: 4 - Beta
Description-Content-Type: text/x-rst

.. image:: https://odoo-community.org/readme-banner-image
   :target: https://odoo-community.org/get-involved?utm_source=readme
   :alt: Odoo Community Association

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

.. 
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   !! This file is generated by oca-gen-addon-readme !!
   !! changes will be overwritten.                   !!
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   !! source digest: sha256:6b11dffa007f30e79761ee3eb13e477f619cefab45fad21136edb5d20b4a7cdd
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/license-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/18.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-18-0/server-tools-18-0-base_time_parameter
    :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
    :target: https://runboat.odoo-community.org/builds?repo=OCA/server-tools&target_branch=18.0
    :alt: Try me on Runboat

|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:: 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:: 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:: 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 to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/server-tools/issues/new?body=module:%20base_time_parameter%0Aversion:%2018.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>
- ExoSoftware (André Leite) <andre.leite@exo.pt>
- hitrosol (Panca Putra Pakpahan) <ppakpahan@solusiaglis.co.id>

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/18.0/base_time_parameter>`_ project on GitHub.

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