diff --git a/ddmrp_history/README.rst b/ddmrp_history/README.rst new file mode 100644 index 000000000..bbf41e15b --- /dev/null +++ b/ddmrp_history/README.rst @@ -0,0 +1,125 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +============= +DDMRP History +============= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:7dac235904fbe56bc8cbf61377ca0e76c5f9f26c31325e271a49ee0f08651f29 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png + :target: https://odoo-community.org/page/development-status + :alt: Production/Stable +.. |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%2Fddmrp-lightgray.png?logo=github + :target: https://github.com/OCA/ddmrp/tree/19.0/ddmrp_history + :alt: OCA/ddmrp +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/ddmrp-19-0/ddmrp-19-0-ddmrp_history + :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/ddmrp&target_branch=19.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Allow to extend DDMRP App to store historical data of buffers. + +**Table of contents** + +.. contents:: + :local: + +Installation +============ + +You need to install the python pandas library: + +:: + + pip install pandas==0.25.3 + +Usage +===== + +You can access, as a inventory manager, to all the DDMRP historical data +throught *Inventory > Reports > DDMRP Buffer History*. Additionally you +can see a historical evolution chart of any buffer at the bottom of its +form view, either by a planning or a execution perspective. + +Changelog +========= + +Follow the history of changes in `GitHub Pull +Requests `__. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* ForgeFlow + +Contributors +------------ + +- Lois Rilo +- Jordi Ballester +- Akim Juillerat +- Christopher Ormaza + +Other credits +------------- + +The initial development of this module has been financially supported +by: + +- Aleph Objects, Inc. + +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-JordiBForgeFlow| image:: https://github.com/JordiBForgeFlow.png?size=40px + :target: https://github.com/JordiBForgeFlow + :alt: JordiBForgeFlow +.. |maintainer-LoisRForgeFlow| image:: https://github.com/LoisRForgeFlow.png?size=40px + :target: https://github.com/LoisRForgeFlow + :alt: LoisRForgeFlow + +Current `maintainers `__: + +|maintainer-JordiBForgeFlow| |maintainer-LoisRForgeFlow| + +This module is part of the `OCA/ddmrp `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/ddmrp_history/__init__.py b/ddmrp_history/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/ddmrp_history/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/ddmrp_history/__manifest__.py b/ddmrp_history/__manifest__.py new file mode 100644 index 000000000..ab3190bf4 --- /dev/null +++ b/ddmrp_history/__manifest__.py @@ -0,0 +1,24 @@ +# Copyright 2017-22 ForgeFlow S.L. (https://www.forgeflow.com) +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +{ + "name": "DDMRP History", + "summary": "Allow to store historical data of DDMRP buffers.", + "version": "19.0.1.0.0", + "development_status": "Production/Stable", + "author": "ForgeFlow, Odoo Community Association (OCA)", + "maintainers": ["JordiBForgeFlow", "LoisRForgeFlow"], + "website": "https://github.com/OCA/ddmrp", + "category": "Warehouse Management", + "depends": ["ddmrp"], + "data": [ + "security/ir.model.access.csv", + "security/security.xml", + "views/ddmrp_history_view.xml", + "views/stock_buffer_view.xml", + ], + "demo": ["demo/ddmrp.history.csv"], + "external_dependencies": {"python": ["pandas>=0.25.3"]}, + "license": "LGPL-3", + "installable": True, +} diff --git a/ddmrp_history/demo/ddmrp.history.csv b/ddmrp_history/demo/ddmrp.history.csv new file mode 100644 index 000000000..85f04dbc7 --- /dev/null +++ b/ddmrp_history/demo/ddmrp.history.csv @@ -0,0 +1,12 @@ +id,buffer_id/id,date,net_flow_position,on_hand_position,top_of_green,top_of_red,top_of_yellow +ddmrp_history_rm01_1,ddmrp.stock_buffer_rm01,2017-09-14 00:45:32,400,400,492.82,122.28,400.88 +ddmrp_history_rm01_2,ddmrp.stock_buffer_rm01,2017-09-14 03:53:30,400,400,492.82,122.28,400.88 +ddmrp_history_rm01_3,ddmrp.stock_buffer_rm01,2017-09-14 07:19:22,400,400,492.82,122.28,400.88 +ddmrp_history_rm01_4,ddmrp.stock_buffer_rm01,2017-09-14 10:39:18,400,400,492.82,122.28,400.88 +ddmrp_history_rm01_5,ddmrp.stock_buffer_rm01,2017-09-14 13:56:05,395,395,496.94,123.3,404.23 +ddmrp_history_rm01_6,ddmrp.stock_buffer_rm01,2017-09-14 17:15:05,395,395,496.94,123.3,404.23 +ddmrp_history_rm01_7,ddmrp.stock_buffer_rm01,2017-09-14 20:37:16,390,390,501.08,124.33,407.6 +ddmrp_history_rm01_8,ddmrp.stock_buffer_rm01,2017-09-15 00:05:02,389,389,412.74,102.41,335.74 +ddmrp_history_rm01_9,ddmrp.stock_buffer_rm01,2017-09-15 18:55:42,381,381,419.35,104.05,341.12 +ddmrp_history_rm01_10,ddmrp.stock_buffer_rm01,2017-09-18 16:33:40,371,371,266.62,66.15,216.88 +ddmrp_history_rm01_11,ddmrp.stock_buffer_rm01,2017-09-18 19:59:13,387,371,266.62,66.15,216.88 diff --git a/ddmrp_history/i18n/ddmrp_history.pot b/ddmrp_history/i18n/ddmrp_history.pot new file mode 100644 index 000000000..d931c4dac --- /dev/null +++ b/ddmrp_history/i18n/ddmrp_history.pot @@ -0,0 +1,161 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * ddmrp_history +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__adu +msgid "ADU" +msgstr "" + +#. module: ddmrp_history +#: model:ir.model.fields,help:ddmrp_history.field_ddmrp_history__adu +msgid "Average Daily Usage" +msgstr "" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__buffer_id +msgid "Buffer" +msgstr "" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__company_id +msgid "Company" +msgstr "" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__create_uid +msgid "Created by" +msgstr "" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__create_date +msgid "Created on" +msgstr "" + +#. module: ddmrp_history +#: model:ir.actions.act_window,name:ddmrp_history.action_ddmrp_history +#: model:ir.ui.menu,name:ddmrp_history.menu_ddmrp_history +msgid "DDMRP Buffer History" +msgstr "" + +#. module: ddmrp_history +#: model:ir.model,name:ddmrp_history.model_ddmrp_history +msgid "DDMRP History" +msgstr "" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__date +msgid "Date" +msgstr "" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__display_name +msgid "Display Name" +msgstr "" + +#. module: ddmrp_history +#: model_terms:ir.ui.view,arch_db:ddmrp_history.stock_buffer_view_form +msgid "Execution Chart" +msgstr "" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_stock_buffer__execution_history_chart +msgid "Execution Historical Chart" +msgstr "" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_stock_buffer__planning_history_chart +msgid "Historical Chart" +msgstr "" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__id +msgid "ID" +msgstr "" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__write_date +msgid "Last Updated on" +msgstr "" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__net_flow_position +msgid "NFP" +msgstr "" + +#. module: ddmrp_history +#: model:ir.model.fields,help:ddmrp_history.field_ddmrp_history__net_flow_position +msgid "Net flow position" +msgstr "" + +#. module: ddmrp_history +#. odoo-python +#: code:addons/ddmrp_history/models/stock_buffer.py:0 +msgid "Not enough data available." +msgstr "" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__on_hand_position +msgid "OHP" +msgstr "" + +#. module: ddmrp_history +#: model:ir.model.fields,help:ddmrp_history.field_ddmrp_history__on_hand_position +msgid "On-Hand Position" +msgstr "" + +#. module: ddmrp_history +#: model_terms:ir.ui.view,arch_db:ddmrp_history.stock_buffer_view_form +msgid "Planning Chart" +msgstr "" + +#. module: ddmrp_history +#: model:ir.model,name:ddmrp_history.model_stock_buffer +msgid "Stock Buffer" +msgstr "" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__top_of_green +msgid "TOG" +msgstr "" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__top_of_red +msgid "TOR" +msgstr "" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__top_of_yellow +msgid "TOY" +msgstr "" + +#. module: ddmrp_history +#: model:ir.model.fields,help:ddmrp_history.field_ddmrp_history__top_of_green +msgid "Top of Green" +msgstr "" + +#. module: ddmrp_history +#: model:ir.model.fields,help:ddmrp_history.field_ddmrp_history__top_of_red +msgid "Top of Red" +msgstr "" + +#. module: ddmrp_history +#: model:ir.model.fields,help:ddmrp_history.field_ddmrp_history__top_of_yellow +msgid "Top of Yellow" +msgstr "" diff --git a/ddmrp_history/i18n/es.po b/ddmrp_history/i18n/es.po new file mode 100644 index 000000000..84f35b822 --- /dev/null +++ b/ddmrp_history/i18n/es.po @@ -0,0 +1,169 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * ddmrp_history +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-03-06 11:48+0000\n" +"PO-Revision-Date: 2024-04-29 11:36+0000\n" +"Last-Translator: Lois Rilo \n" +"Language-Team: \n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__adu +msgid "ADU" +msgstr "CPD" + +#. module: ddmrp_history +#: model:ir.model.fields,help:ddmrp_history.field_ddmrp_history__adu +msgid "Average Daily Usage" +msgstr "Consumo Promedio Diario" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__buffer_id +msgid "Buffer" +msgstr "Búfer" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__company_id +msgid "Company" +msgstr "" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__create_uid +msgid "Created by" +msgstr "Creado por" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__create_date +msgid "Created on" +msgstr "Creado en" + +#. module: ddmrp_history +#: model:ir.actions.act_window,name:ddmrp_history.action_ddmrp_history +#: model:ir.ui.menu,name:ddmrp_history.menu_ddmrp_history +msgid "DDMRP Buffer History" +msgstr "Historia de Amortiguador DDMRP" + +#. module: ddmrp_history +#: model:ir.model,name:ddmrp_history.model_ddmrp_history +msgid "DDMRP History" +msgstr "Historia DDMRP" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__date +msgid "Date" +msgstr "Fecha" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__display_name +msgid "Display Name" +msgstr "Nombre mostrado" + +#. module: ddmrp_history +#: model_terms:ir.ui.view,arch_db:ddmrp_history.stock_buffer_view_form +msgid "Execution Chart" +msgstr "Gráfico de Ejecución" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_stock_buffer__execution_history_chart +msgid "Execution Historical Chart" +msgstr "Gráfico de Ejecución de Historia" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_stock_buffer__planning_history_chart +msgid "Historical Chart" +msgstr "Grafico Histórico" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__id +msgid "ID" +msgstr "ID" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__write_uid +msgid "Last Updated by" +msgstr "Última Actualización por" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__write_date +msgid "Last Updated on" +msgstr "Última Actualización en" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__net_flow_position +msgid "NFP" +msgstr "PFN" + +#. module: ddmrp_history +#: model:ir.model.fields,help:ddmrp_history.field_ddmrp_history__net_flow_position +msgid "Net flow position" +msgstr "Posición de flujo neto" + +#. module: ddmrp_history +#. odoo-python +#: code:addons/ddmrp_history/models/stock_buffer.py:0 +#, python-format +msgid "Not enough data available." +msgstr "No hay suficientes datos disponibles." + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__on_hand_position +msgid "OHP" +msgstr "PEM" + +#. module: ddmrp_history +#: model:ir.model.fields,help:ddmrp_history.field_ddmrp_history__on_hand_position +msgid "On-Hand Position" +msgstr "Posición En Mano" + +#. module: ddmrp_history +#: model_terms:ir.ui.view,arch_db:ddmrp_history.stock_buffer_view_form +msgid "Planning Chart" +msgstr "Gráfico de Planificación" + +#. module: ddmrp_history +#: model:ir.model,name:ddmrp_history.model_stock_buffer +msgid "Stock Buffer" +msgstr "Amortiguador de Inventario" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__top_of_green +msgid "TOG" +msgstr "TDV" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__top_of_red +msgid "TOR" +msgstr "TDR" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__top_of_yellow +msgid "TOY" +msgstr "TDA" + +#. module: ddmrp_history +#: model:ir.model.fields,help:ddmrp_history.field_ddmrp_history__top_of_green +msgid "Top of Green" +msgstr "Tope de Verde" + +#. module: ddmrp_history +#: model:ir.model.fields,help:ddmrp_history.field_ddmrp_history__top_of_red +msgid "Top of Red" +msgstr "Tope de Rojo" + +#. module: ddmrp_history +#: model:ir.model.fields,help:ddmrp_history.field_ddmrp_history__top_of_yellow +msgid "Top of Yellow" +msgstr "Tope de Amarillo" + +#~ msgid "Last Modified on" +#~ msgstr "Última Modificación en" diff --git a/ddmrp_history/i18n/fr.po b/ddmrp_history/i18n/fr.po new file mode 100644 index 000000000..2e2f73a13 --- /dev/null +++ b/ddmrp_history/i18n/fr.po @@ -0,0 +1,168 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * ddmrp_history +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2020-07-22 10:13+0000\n" +"Last-Translator: c2cdidier \n" +"Language-Team: none\n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 3.10\n" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__adu +msgid "ADU" +msgstr "CMJ" + +#. module: ddmrp_history +#: model:ir.model.fields,help:ddmrp_history.field_ddmrp_history__adu +msgid "Average Daily Usage" +msgstr "Consommation moyenne journalière" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__buffer_id +msgid "Buffer" +msgstr "Buffer" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__company_id +msgid "Company" +msgstr "" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__create_uid +msgid "Created by" +msgstr "Créé par" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__create_date +msgid "Created on" +msgstr "Créé le" + +#. module: ddmrp_history +#: model:ir.actions.act_window,name:ddmrp_history.action_ddmrp_history +#: model:ir.ui.menu,name:ddmrp_history.menu_ddmrp_history +msgid "DDMRP Buffer History" +msgstr "DDMRP Historique de Buffer" + +#. module: ddmrp_history +#: model:ir.model,name:ddmrp_history.model_ddmrp_history +msgid "DDMRP History" +msgstr "DDMRP Historique" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__date +msgid "Date" +msgstr "Date" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__display_name +msgid "Display Name" +msgstr "Nom affiché" + +#. module: ddmrp_history +#: model_terms:ir.ui.view,arch_db:ddmrp_history.stock_buffer_view_form +msgid "Execution Chart" +msgstr "Graphique d'exécution" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_stock_buffer__execution_history_chart +msgid "Execution Historical Chart" +msgstr "Graphique historique d'exécution" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_stock_buffer__planning_history_chart +msgid "Historical Chart" +msgstr "Graphique historique" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__id +msgid "ID" +msgstr "ID" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__write_uid +msgid "Last Updated by" +msgstr "Dernière modification par" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__write_date +msgid "Last Updated on" +msgstr "Dernière mise à jour le" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__net_flow_position +msgid "NFP" +msgstr "NFP" + +#. module: ddmrp_history +#: model:ir.model.fields,help:ddmrp_history.field_ddmrp_history__net_flow_position +msgid "Net flow position" +msgstr "Stock disponible" + +#. module: ddmrp_history +#. odoo-python +#: code:addons/ddmrp_history/models/stock_buffer.py:0 +#, python-format +msgid "Not enough data available." +msgstr "Trop peu de données disponibles." + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__on_hand_position +msgid "OHP" +msgstr "" + +#. module: ddmrp_history +#: model:ir.model.fields,help:ddmrp_history.field_ddmrp_history__on_hand_position +msgid "On-Hand Position" +msgstr "" + +#. module: ddmrp_history +#: model_terms:ir.ui.view,arch_db:ddmrp_history.stock_buffer_view_form +msgid "Planning Chart" +msgstr "Graphique de planification" + +#. module: ddmrp_history +#: model:ir.model,name:ddmrp_history.model_stock_buffer +msgid "Stock Buffer" +msgstr "Buffer de stock" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__top_of_green +msgid "TOG" +msgstr "TOG" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__top_of_red +msgid "TOR" +msgstr "TOR" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__top_of_yellow +msgid "TOY" +msgstr "TOY" + +#. module: ddmrp_history +#: model:ir.model.fields,help:ddmrp_history.field_ddmrp_history__top_of_green +msgid "Top of Green" +msgstr "Top du vert" + +#. module: ddmrp_history +#: model:ir.model.fields,help:ddmrp_history.field_ddmrp_history__top_of_red +msgid "Top of Red" +msgstr "Top du rouge" + +#. module: ddmrp_history +#: model:ir.model.fields,help:ddmrp_history.field_ddmrp_history__top_of_yellow +msgid "Top of Yellow" +msgstr "Top du jaune" + +#~ msgid "Last Modified on" +#~ msgstr "Dernière modification le" diff --git a/ddmrp_history/i18n/it.po b/ddmrp_history/i18n/it.po new file mode 100644 index 000000000..be826a883 --- /dev/null +++ b/ddmrp_history/i18n/it.po @@ -0,0 +1,168 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * ddmrp_history +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-05-08 07:45+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__adu +msgid "ADU" +msgstr "ADU" + +#. module: ddmrp_history +#: model:ir.model.fields,help:ddmrp_history.field_ddmrp_history__adu +msgid "Average Daily Usage" +msgstr "Utilizzo medio giornaliero" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__buffer_id +msgid "Buffer" +msgstr "Buffer" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__company_id +msgid "Company" +msgstr "Azienda" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__create_uid +msgid "Created by" +msgstr "Creato da" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__create_date +msgid "Created on" +msgstr "Creato il" + +#. module: ddmrp_history +#: model:ir.actions.act_window,name:ddmrp_history.action_ddmrp_history +#: model:ir.ui.menu,name:ddmrp_history.menu_ddmrp_history +msgid "DDMRP Buffer History" +msgstr "Storico buffer DDMRP" + +#. module: ddmrp_history +#: model:ir.model,name:ddmrp_history.model_ddmrp_history +msgid "DDMRP History" +msgstr "Storico DDMRP" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__date +msgid "Date" +msgstr "Data" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__display_name +msgid "Display Name" +msgstr "Nome visualizzato" + +#. module: ddmrp_history +#: model_terms:ir.ui.view,arch_db:ddmrp_history.stock_buffer_view_form +msgid "Execution Chart" +msgstr "Grafico esecuzione" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_stock_buffer__execution_history_chart +msgid "Execution Historical Chart" +msgstr "Grafico storico esecuzione" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_stock_buffer__planning_history_chart +msgid "Historical Chart" +msgstr "Grafico storico" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__id +msgid "ID" +msgstr "ID" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__write_uid +msgid "Last Updated by" +msgstr "Ultimo aggiornamento di" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__write_date +msgid "Last Updated on" +msgstr "Ultimo aggiornamento il" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__net_flow_position +msgid "NFP" +msgstr "NFP" + +#. module: ddmrp_history +#: model:ir.model.fields,help:ddmrp_history.field_ddmrp_history__net_flow_position +msgid "Net flow position" +msgstr "Posizione flusso netta" + +#. module: ddmrp_history +#. odoo-python +#: code:addons/ddmrp_history/models/stock_buffer.py:0 +#, python-format +msgid "Not enough data available." +msgstr "Dati disponibili non sufficienti." + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__on_hand_position +msgid "OHP" +msgstr "OHP" + +#. module: ddmrp_history +#: model:ir.model.fields,help:ddmrp_history.field_ddmrp_history__on_hand_position +msgid "On-Hand Position" +msgstr "Posizione a disposizione" + +#. module: ddmrp_history +#: model_terms:ir.ui.view,arch_db:ddmrp_history.stock_buffer_view_form +msgid "Planning Chart" +msgstr "Grafico pianificazione" + +#. module: ddmrp_history +#: model:ir.model,name:ddmrp_history.model_stock_buffer +msgid "Stock Buffer" +msgstr "Buffer di materiale" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__top_of_green +msgid "TOG" +msgstr "TOG" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__top_of_red +msgid "TOR" +msgstr "TOR" + +#. module: ddmrp_history +#: model:ir.model.fields,field_description:ddmrp_history.field_ddmrp_history__top_of_yellow +msgid "TOY" +msgstr "TOY" + +#. module: ddmrp_history +#: model:ir.model.fields,help:ddmrp_history.field_ddmrp_history__top_of_green +msgid "Top of Green" +msgstr "Superiore della verde" + +#. module: ddmrp_history +#: model:ir.model.fields,help:ddmrp_history.field_ddmrp_history__top_of_red +msgid "Top of Red" +msgstr "Superiore della rossa" + +#. module: ddmrp_history +#: model:ir.model.fields,help:ddmrp_history.field_ddmrp_history__top_of_yellow +msgid "Top of Yellow" +msgstr "Superiore della gialla" + +#~ msgid "Last Modified on" +#~ msgstr "Ultima modifica il" diff --git a/ddmrp_history/models/__init__.py b/ddmrp_history/models/__init__.py new file mode 100644 index 000000000..f06a0d1ea --- /dev/null +++ b/ddmrp_history/models/__init__.py @@ -0,0 +1,2 @@ +from . import ddmrp_history +from . import stock_buffer diff --git a/ddmrp_history/models/ddmrp_history.py b/ddmrp_history/models/ddmrp_history.py new file mode 100644 index 000000000..ca58c6daf --- /dev/null +++ b/ddmrp_history/models/ddmrp_history.py @@ -0,0 +1,53 @@ +# Copyright 2017-20 ForgeFlow S.L. (https://www.forgeflow.com) +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +from odoo import fields, models + + +class DdmrpHistory(models.Model): + _name = "ddmrp.history" + _description = "DDMRP History" + + buffer_id = fields.Many2one( + comodel_name="stock.buffer", + string="Buffer", + ondelete="cascade", + index=True, + ) + date = fields.Datetime() + top_of_red = fields.Float( + string="TOR", + help="Top of Red", + aggregator="avg", + ) + top_of_yellow = fields.Float( + string="TOY", + help="Top of Yellow", + aggregator="avg", + ) + top_of_green = fields.Float( + string="TOG", + help="Top of Green", + aggregator="avg", + ) + net_flow_position = fields.Float( + string="NFP", + digits="Product Unit of Measure", + help="Net flow position", + aggregator="avg", + ) + on_hand_position = fields.Float( + string="OHP", + digits="Product Unit of Measure", + help="On-Hand Position", + aggregator="avg", + ) + adu = fields.Float( + string="ADU", + digits="Product Unit of Measure", + aggregator="avg", + help="Average Daily Usage", + ) + company_id = fields.Many2one( + related="buffer_id.company_id", + ) diff --git a/ddmrp_history/models/stock_buffer.py b/ddmrp_history/models/stock_buffer.py new file mode 100644 index 000000000..e1b18b62d --- /dev/null +++ b/ddmrp_history/models/stock_buffer.py @@ -0,0 +1,309 @@ +# Copyright 2017-20 ForgeFlow S.L. (https://www.forgeflow.com) +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +import json +import logging +from math import pi + +from odoo import fields, models + +_logger = logging.getLogger(__name__) +try: + import numpy as np + import pandas as pd + from bokeh.embed import components + from bokeh.models import DatetimeTickFormatter, HoverTool + from bokeh.plotting import figure +except (OSError, ImportError) as err: + _logger.debug(err) + + +class StockBuffer(models.Model): + _inherit = "stock.buffer" + + planning_history_chart = fields.Text( + string="Historical Chart", + compute="_compute_history_chart", + ) + execution_history_chart = fields.Text( + string="Execution Historical Chart", + compute="_compute_execution_history_chart", + ) + + def _prepare_history_data(self): + self.ensure_one() + data = { + "buffer_id": self.id, + "date": fields.Datetime.now(), + "top_of_red": self.top_of_red, + "top_of_yellow": self.top_of_yellow, + "top_of_green": self.top_of_green, + "net_flow_position": self.net_flow_position, + "on_hand_position": self.product_location_qty_available_not_res, + "adu": self.adu, + } + return data + + def cron_actions(self, only_nfp=False): + res = super().cron_actions(only_nfp=only_nfp) + data = self._prepare_history_data() + if not self.env.context.get("no_ddmrp_history"): + self.env["ddmrp.history"].sudo().create(data) + return res + + def _compute_history_chart(self): + def stacked(df, categories): + areas = {} + last = np.zeros(len(df[categories[0]])) + for cat in categories: + _next = last + df[cat] + areas[cat] = np.hstack((last[::-1], _next)) + last = _next + return areas + + hex_colors = self._get_colors_hex_map(pallete="planning") + planning_colors = [ + hex_colors["1_red"], + hex_colors["2_yellow"], + hex_colors["3_green"], + ] + for rec in self: + history = self.env["ddmrp.history"].search( + [("buffer_id", "=", rec.id)], order="date" + ) + if len(history) < 2: + rec.planning_history_chart = json.dumps( + { + "div": self.env._("Not enough data available."), + "script": "", + } + ) + continue + + N = len(history) + categories = ["top_of_red", "top_of_yellow", "top_of_green"] + data = {} + + dates = [r.date for r in history] + data["date"] = dates + data[categories[0]] = [r.top_of_red for r in history] + data[categories[1]] = [r.top_of_yellow - r.top_of_red for r in history] + data[categories[2]] = [r.top_of_green - r.top_of_yellow for r in history] + data["net_flow_position"] = [r.net_flow_position for r in history] + data["on_hand_position"] = [r.on_hand_position for r in history] + + df = pd.DataFrame(data) + df = df.set_index(["date"]) + + areas = stacked(df, categories) + + x2 = np.hstack((data["date"][::-1], data["date"])) + + tops = [ + data[categories[0]][i] + data[categories[1]][i] + data[categories[2]][i] + for i in range(N) + ] + [max(data["on_hand_position"]), max(data["net_flow_position"])] + top_y = max(tops) + min_y = min( + [0, min(data["on_hand_position"]), min(data["net_flow_position"])] + ) + if top_y <= min_y: + top_y = min_y + 100 + p = figure( + frame_height=400, + x_range=(dates[0], dates[-1]), + y_range=(min_y, top_y), + x_axis_type="datetime", + ) + p.sizing_mode = "stretch_width" + p.toolbar.logo = None + + p.grid.minor_grid_line_color = "#eeeeee" + p.patches( + [x2] * len(areas), + [areas[cat] for cat in categories], + color=planning_colors, + alpha=0.8, + line_color=None, + ) + date_format = ( + self.env["res.lang"]._lang_get(self.env.lang or "en_US").date_format + ) + p.xaxis.formatter = DatetimeTickFormatter( + hours=date_format, + days=date_format, + months=date_format, + years=date_format, + ) + p.xaxis.major_label_orientation = pi / 4 + p.xaxis.axis_label_text_font = "helvetica" + + unit = rec.product_uom.name + hover = HoverTool( + tooltips=[("qty", f"$y {unit}")], point_policy="follow_mouse" + ) + p.add_tools(hover) + + p.line(dates, data["net_flow_position"], line_width=3) + p.line(dates, data["on_hand_position"], line_width=3, line_dash="dotted") + + script, div = components(p, wrap_script=False) + json_data = json.dumps( + { + "div": div, + "script": script, + } + ) + rec.planning_history_chart = json_data + + def _compute_execution_history_chart(self): + start_stack = 0 + + def stacked(df, categories): + areas = {} + last = np.zeros(len(df[categories[0]])) + last += start_stack + for cat in categories: + _next = last + df[cat] + areas[cat] = np.hstack((last[::-1], _next)) + last = _next + return areas + + hex_colors = self._get_colors_hex_map(pallete="execution") + execution_colors = [ + hex_colors["0_dark_red"], + hex_colors["1_red"], + hex_colors["2_yellow"], + hex_colors["3_green"], + hex_colors["2_yellow"], + hex_colors["1_red"], + hex_colors["0_dark_red"], + ] + history_model = self.env["ddmrp.history"] + for rec in self: + domain = [("buffer_id", "=", rec.id)] + history_oh = history_model.search( + domain, order="on_hand_position desc", limit=1 + ) + history_tog = history_model.search( + domain + [("top_of_green", "!=", False)], + order="top_of_green desc", + limit=1, + ) + finish_stack = max(history_oh.on_hand_position, history_tog.top_of_green) + + history = history_model.search( + domain, order="on_hand_position asc", limit=1 + ) + start_stack = history.on_hand_position + if start_stack >= 0.0: + start_stack = 0.0 + history = history_model.search(domain, order="date") + if len(history) < 2: + rec.execution_history_chart = json.dumps( + { + "div": self.env._("Not enough data available."), + "script": "", + } + ) + continue + + N = len(history) + + categories = [ + "dark_red_low", + "top_of_red_low", + "top_of_yellow_low", + "top_of_green", + "top_of_yellow", + "top_of_red", + "dark_red", + ] + data = {} + + dates = [r.date for r in history] + data["date"] = dates + data[categories[0]] = [(0 - start_stack) for r in history] + data[categories[1]] = [(r.top_of_red / 2) for r in history] + data[categories[2]] = [(r.top_of_red / 2) for r in history] + data[categories[3]] = [r.top_of_green - r.top_of_yellow for r in history] + data[categories[4]] = [ + (r.top_of_green - r.top_of_red - (r.top_of_green - r.top_of_yellow)) / 2 + for r in history + ] + data[categories[5]] = [ + (r.top_of_green - r.top_of_red - (r.top_of_green - r.top_of_yellow)) / 2 + for r in history + ] + data[categories[6]] = [ + finish_stack + - r.top_of_red + - (r.top_of_green - r.top_of_yellow) + - (r.top_of_green - r.top_of_red - (r.top_of_green - r.top_of_yellow)) + for r in history + ] + + data["on_hand_position"] = [r.on_hand_position for r in history] + + df = pd.DataFrame(data) + df = df.set_index(["date"]) + + areas = stacked(df, categories) + + x2 = np.hstack((data["date"][::-1], data["date"])) + + tops = [ + data[categories[0]][i] + + data[categories[1]][i] + + data[categories[2]][i] + + data[categories[3]][i] + + data[categories[4]][i] + + data[categories[5]][i] + + data[categories[6]][i] + for i in range(N) + ] + top_y = max(tops) + p = figure( + frame_height=400, + x_range=(dates[0], dates[-1]), + y_range=(start_stack, top_y or 100), + x_axis_type="datetime", + ) + p.sizing_mode = "stretch_width" + p.toolbar.logo = None + + p.grid.minor_grid_line_color = "#eeeeee" + p.patches( + [x2] * len(areas), + [areas[cat] for cat in categories], + color=execution_colors, + alpha=0.8, + line_color=None, + ) + date_format = ( + self.env["res.lang"]._lang_get(self.env.lang or "en_US").date_format + ) + p.xaxis.formatter = DatetimeTickFormatter( + hours=date_format, + days=date_format, + months=date_format, + years=date_format, + ) + p.xaxis.major_label_orientation = pi / 4 + + unit = rec.product_uom.name + hover = HoverTool( + tooltips=[("qty", f"$y {unit}")], point_policy="follow_mouse" + ) + p.add_tools(hover) + + p.line(dates, data["on_hand_position"], line_width=3, line_dash="dotted") + + script, div = components(p, wrap_script=False) + json_data = json.dumps( + { + "div": div, + "script": script, + } + ) + rec.execution_history_chart = json_data diff --git a/ddmrp_history/pyproject.toml b/ddmrp_history/pyproject.toml new file mode 100644 index 000000000..4231d0ccc --- /dev/null +++ b/ddmrp_history/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/ddmrp_history/readme/CONTRIBUTORS.md b/ddmrp_history/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..dfc3a706f --- /dev/null +++ b/ddmrp_history/readme/CONTRIBUTORS.md @@ -0,0 +1,4 @@ +- Lois Rilo \<\> +- Jordi Ballester \<\> +- Akim Juillerat \<\> +- Christopher Ormaza \<\> diff --git a/ddmrp_history/readme/CREDITS.md b/ddmrp_history/readme/CREDITS.md new file mode 100644 index 000000000..a53ec413f --- /dev/null +++ b/ddmrp_history/readme/CREDITS.md @@ -0,0 +1,4 @@ +The initial development of this module has been financially supported +by: + +- Aleph Objects, Inc. diff --git a/ddmrp_history/readme/DESCRIPTION.md b/ddmrp_history/readme/DESCRIPTION.md new file mode 100644 index 000000000..897126e77 --- /dev/null +++ b/ddmrp_history/readme/DESCRIPTION.md @@ -0,0 +1 @@ +Allow to extend DDMRP App to store historical data of buffers. diff --git a/ddmrp_history/readme/HISTORY.md b/ddmrp_history/readme/HISTORY.md new file mode 100644 index 000000000..536d75d6f --- /dev/null +++ b/ddmrp_history/readme/HISTORY.md @@ -0,0 +1 @@ +Follow the history of changes in [GitHub Pull Requests](https://github.com/OCA/ddmrp/pulls?q=is%3Apr+ddmrp_history+is%3Aclosed). diff --git a/ddmrp_history/readme/INSTALL.md b/ddmrp_history/readme/INSTALL.md new file mode 100644 index 000000000..14d37c2d1 --- /dev/null +++ b/ddmrp_history/readme/INSTALL.md @@ -0,0 +1,3 @@ +You need to install the python pandas library: + + pip install pandas==0.25.3 diff --git a/ddmrp_history/readme/USAGE.md b/ddmrp_history/readme/USAGE.md new file mode 100644 index 000000000..a5bee7c81 --- /dev/null +++ b/ddmrp_history/readme/USAGE.md @@ -0,0 +1,4 @@ +You can access, as a inventory manager, to all the DDMRP historical data +throught *Inventory \> Reports \> DDMRP Buffer History*. Additionally +you can see a historical evolution chart of any buffer at the bottom of +its form view, either by a planning or a execution perspective. diff --git a/ddmrp_history/security/ir.model.access.csv b/ddmrp_history/security/ir.model.access.csv new file mode 100644 index 000000000..7c23ff68b --- /dev/null +++ b/ddmrp_history/security/ir.model.access.csv @@ -0,0 +1,3 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +ddmrp_history_user,ddmrp.history.user,model_ddmrp_history,ddmrp.group_stock_buffer_maintainer,1,0,0,0 +ddmrp_history_manager,ddmrp.history.manager,model_ddmrp_history,ddmrp.group_ddmrp_manager,1,0,0,1 diff --git a/ddmrp_history/security/security.xml b/ddmrp_history/security/security.xml new file mode 100644 index 000000000..91bf82352 --- /dev/null +++ b/ddmrp_history/security/security.xml @@ -0,0 +1,11 @@ + + + + + DDMRP History Multi-Company + + + [('company_id', 'in', company_ids)] + + diff --git a/ddmrp_history/static/description/icon.png b/ddmrp_history/static/description/icon.png new file mode 100644 index 000000000..90c92e98d Binary files /dev/null and b/ddmrp_history/static/description/icon.png differ diff --git a/ddmrp_history/static/description/index.html b/ddmrp_history/static/description/index.html new file mode 100644 index 000000000..c3963737c --- /dev/null +++ b/ddmrp_history/static/description/index.html @@ -0,0 +1,465 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

DDMRP History

+ +

Production/Stable License: LGPL-3 OCA/ddmrp Translate me on Weblate Try me on Runboat

+

Allow to extend DDMRP App to store historical data of buffers.

+

Table of contents

+ +
+

Installation

+

You need to install the python pandas library:

+
+pip install pandas==0.25.3
+
+
+
+

Usage

+

You can access, as a inventory manager, to all the DDMRP historical data +throught Inventory > Reports > DDMRP Buffer History. Additionally you +can see a historical evolution chart of any buffer at the bottom of its +form view, either by a planning or a execution perspective.

+
+
+

Changelog

+

Follow the history of changes in GitHub Pull +Requests.

+
+
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • ForgeFlow
  • +
+
+
+

Contributors

+ +
+
+

Other credits

+

The initial development of this module has been financially supported +by:

+
    +
  • Aleph Objects, Inc.
  • +
+
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

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.

+

Current maintainers:

+

JordiBForgeFlow LoisRForgeFlow

+

This module is part of the OCA/ddmrp project on GitHub.

+

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

+
+
+
+
+ + diff --git a/ddmrp_history/tests/__init__.py b/ddmrp_history/tests/__init__.py new file mode 100644 index 000000000..9dd823b7c --- /dev/null +++ b/ddmrp_history/tests/__init__.py @@ -0,0 +1 @@ +from . import test_ddmrp_history diff --git a/ddmrp_history/tests/test_ddmrp_history.py b/ddmrp_history/tests/test_ddmrp_history.py new file mode 100644 index 000000000..75b81824a --- /dev/null +++ b/ddmrp_history/tests/test_ddmrp_history.py @@ -0,0 +1,35 @@ +# Copyright 2018 Camptocamp SA +# Copyright 2019 ForgeFlow S.L. (https://www.forgeflow.com) +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +from datetime import datetime, timedelta + +from odoo import fields + +from odoo.addons.ddmrp.tests.common import TestDdmrpCommon + + +class TestDDMRPHistory(TestDdmrpCommon): + def test_history(self): + self.buffer_purchase.write( + {"adu_fixed": 10, "order_cycle": 5, "order_spike_horizon": 10} + ) + self.buffer_purchase.cron_actions() + history_today = self.env["ddmrp.history"].search( + [("buffer_id", "=", self.buffer_purchase.id)], order="id desc", limit=1 + ) + self.assertTrue(history_today) + self.assertAlmostEqual( + fields.Datetime.from_string(history_today.date), + datetime.today(), + delta=timedelta(seconds=1), + ) + self.assertEqual(history_today.top_of_red, self.buffer_purchase.top_of_red) + self.assertEqual( + history_today.top_of_yellow, self.buffer_purchase.top_of_yellow + ) + self.assertEqual(history_today.top_of_green, self.buffer_purchase.top_of_green) + # Check that chart computation do not raise an error: + self.buffer_purchase.cron_actions() + self.assertTrue(self.buffer_purchase.planning_history_chart) + self.assertTrue(self.buffer_purchase.execution_history_chart) diff --git a/ddmrp_history/views/ddmrp_history_view.xml b/ddmrp_history/views/ddmrp_history_view.xml new file mode 100644 index 000000000..b2d3ab466 --- /dev/null +++ b/ddmrp_history/views/ddmrp_history_view.xml @@ -0,0 +1,47 @@ + + + + + ddmrp.history.tree + ddmrp.history + + + + + + + + + + + + + + + + ddmrp.history.search + ddmrp.history + + + + + + + + DDMRP Buffer History + ddmrp.history + buffer-history + list,pivot,graph + + + diff --git a/ddmrp_history/views/stock_buffer_view.xml b/ddmrp_history/views/stock_buffer_view.xml new file mode 100644 index 000000000..f3a88ba53 --- /dev/null +++ b/ddmrp_history/views/stock_buffer_view.xml @@ -0,0 +1,34 @@ + + + + + stock.buffer.form - ddmrp_history + stock.buffer + + + + +
+ +
+
+ +
+ +
+
+
+
+
+
diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 000000000..0caf05045 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +# generated from manifests external_dependencies +pandas>=0.25.3