odoo-addon-base-time-parameter


Nameodoo-addon-base-time-parameter JSON
Version 15.0.1.0.0.2 PyPI version JSON
download
home_pagehttps://github.com/OCA/server-tools
SummaryTime dependent parameters Adds the feature to define parameters with time based versions.
upload_time2023-12-02 17:32:23
maintainer
docs_urlNone
authorNimarosa, appstogrow, Odoo Community Association (OCA)
requires_python>=3.8
licenseLGPL-3
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ==============
Time Parameter
==============

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

.. |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/15.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-15-0/server-tools-15-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=15.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-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 to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/server-tools/issues/new?body=module:%20base_time_parameter%0Aversion:%2015.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>

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

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



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/OCA/server-tools",
    "name": "odoo-addon-base-time-parameter",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "",
    "author": "Nimarosa, appstogrow, Odoo Community Association (OCA)",
    "author_email": "support@odoo-community.org",
    "download_url": "",
    "platform": null,
    "description": "==============\nTime Parameter\n==============\n\n.. \n   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n   !! This file is generated by oca-gen-addon-readme !!\n   !! changes will be overwritten.                   !!\n   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n   !! source digest: sha256:b19c48105a6e8ffe0fdf23f4eccc9c87307e294547717716678ea9ddd8a5bd6a\n   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png\n    :target: https://odoo-community.org/page/development-status\n    :alt: Beta\n.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png\n    :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html\n    :alt: License: LGPL-3\n.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github\n    :target: https://github.com/OCA/server-tools/tree/15.0/base_time_parameter\n    :alt: OCA/server-tools\n.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png\n    :target: https://translation.odoo-community.org/projects/server-tools-15-0/server-tools-15-0-base_time_parameter\n    :alt: Translate me on Weblate\n.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png\n    :target: https://runboat.odoo-community.org/builds?repo=OCA/server-tools&target_branch=15.0\n    :alt: Try me on Runboat\n\n|badge1| |badge2| |badge3| |badge4| |badge5|\n\nA value may change over time.\nWith this module you may set starting dates and values.\n\n**Table of contents**\n\n.. contents::\n   :local:\n\nConfiguration\n=============\n\nThe user needs the access right \"Manage Time Parameters\".\n\nUsage\n=====\n\nMenu: \"Settings/Technical/Time Parameters\"\n\nCreate a parameter with different versions (start date and value).\n\nIf model_id is empty, any model/record may get the time parameter.\n\nThe value may be a text or reference.\n\nGet the value like this:\n\n.. code-block:: python\n\n    # Pass no date: using today's date\n    value = model.get_time_parameter(\"parameter_code_or_name\")\n    # Pass a date or datetime\n    value = model.get_time_parameter(\"parameter_code_or_name\", date=datetime.datetime.now()))\n    # Pass the name of a date/datetime field of the record\n    value = record.get_time_parameter(\"parameter_code_or_name\", \"date\")\n\nExample of implementation in another module\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nPayroll implementation:\n\n* Menu \"Payroll/Configuration/Time Parameters\" only shows hr.payslip parameters.\n* New parameters will be hr.payslip parameters.\n* By default, the model_id field is hidden in the form.\n\n.. code-block:: XML\n\n    <record id=\"base_time_parameter_action\" model=\"ir.actions.act_window\">\n        <field name=\"name\">Time Parameters</field>\n        <field name=\"res_model\">base.time.parameter</field>\n        <field name=\"view_mode\">tree,form</field>\n        <field\n            name=\"domain\"\n            eval=\"[('model_id', '=', ref('payroll.model_hr_payslip'))]\"\n        />\n        <field\n            name=\"context\"\n            eval=\"{'default_model_id': ref('payroll.model_hr_payslip')}\"\n        />\n    </record>\n    <menuitem\n        id=\"menu_action_base_time_parameter\"\n        action=\"base_time_parameter_action\"\n        name=\"Time Parameters\"\n        parent=\"payroll_menu_configuration\"\n        sequence=\"35\"\n    />\n\nReference field implementatiton:\n\n.. code-block:: python\n\n    from odoo import fields, models\n\n\n    class TimeParameterVersion(models.Model):\n        _inherit = \"base.time.parameter.version\"\n\n        value_reference = fields.Reference(\n            selection_add=[(\"account.account\", \"Account\")],\n        )\n\nBug Tracker\n===========\n\nBugs are tracked on `GitHub Issues <https://github.com/OCA/server-tools/issues>`_.\nIn case of trouble, please check there if your issue has already been reported.\nIf you spotted it first, help us to smash it by providing a detailed and welcomed\n`feedback <https://github.com/OCA/server-tools/issues/new?body=module:%20base_time_parameter%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.\n\nDo not contact contributors directly about support or help with technical issues.\n\nCredits\n=======\n\nAuthors\n~~~~~~~\n\n* Nimarosa\n* appstogrow\n\nContributors\n~~~~~~~~~~~~\n\n* Nimarosa (Nicolas Rodriguez) <nicolasrsande@gmail.com>\n* appstogrow (Henrik Norlin) <henrik@appstogrow.co>\n* ExoSoftware (Andr\u00e9 Leite) <andre.leite@exo.pt>\n\nMaintainers\n~~~~~~~~~~~\n\nThis module is maintained by the OCA.\n\n.. image:: https://odoo-community.org/logo.png\n   :alt: Odoo Community Association\n   :target: https://odoo-community.org\n\nOCA, or the Odoo Community Association, is a nonprofit organization whose\nmission is to support the collaborative development of Odoo features and\npromote its widespread use.\n\n.. |maintainer-appstogrow| image:: https://github.com/appstogrow.png?size=40px\n    :target: https://github.com/appstogrow\n    :alt: appstogrow\n.. |maintainer-nimarosa| image:: https://github.com/nimarosa.png?size=40px\n    :target: https://github.com/nimarosa\n    :alt: nimarosa\n\nCurrent `maintainers <https://odoo-community.org/page/maintainer-role>`__:\n\n|maintainer-appstogrow| |maintainer-nimarosa| \n\nThis module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/15.0/base_time_parameter>`_ project on GitHub.\n\nYou are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.\n\n\n",
    "bugtrack_url": null,
    "license": "LGPL-3",
    "summary": "Time dependent parameters Adds the feature to define parameters with time based versions.",
    "version": "15.0.1.0.0.2",
    "project_urls": {
        "Homepage": "https://github.com/OCA/server-tools"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ca16a939b34842e2cff0816bc6d3ffd525e961600865f78f485e7f2d52fd7fc5",
                "md5": "768cc64be377d91e8bab1ca0c27faf83",
                "sha256": "8a98f49868c644887156accf5103013c32c63e50e51f3867c40e26c5d33bfe61"
            },
            "downloads": -1,
            "filename": "odoo_addon_base_time_parameter-15.0.1.0.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "768cc64be377d91e8bab1ca0c27faf83",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 45778,
            "upload_time": "2023-12-02T17:32:23",
            "upload_time_iso_8601": "2023-12-02T17:32:23.319457Z",
            "url": "https://files.pythonhosted.org/packages/ca/16/a939b34842e2cff0816bc6d3ffd525e961600865f78f485e7f2d52fd7fc5/odoo_addon_base_time_parameter-15.0.1.0.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-02 17:32:23",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "OCA",
    "github_project": "server-tools",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "odoo-addon-base-time-parameter"
}
        
Elapsed time: 0.15505s