diff --git a/procurement_auto_create_group/README.rst b/procurement_auto_create_group/README.rst new file mode 100644 index 000000000000..ecb6e3b8fea0 --- /dev/null +++ b/procurement_auto_create_group/README.rst @@ -0,0 +1,112 @@ +============================= +Procurement Auto Create Group +============================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:469639cf06197ad827f2cea50416bd52aad40a8c93ab583b87e760755b1f8916 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github + :target: https://github.com/OCA/stock-logistics-warehouse/tree/17.0/procurement_auto_create_group + :alt: OCA/stock-logistics-warehouse +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-17-0/stock-logistics-warehouse-17-0-procurement_auto_create_group + :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/stock-logistics-warehouse&target_branch=17.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows the system to propose automatically new procurement +groups during the procurement run. + +This capability is important when you want to make sure that all the +stock moves resulting from a procurement run will never be mixed with +moves from other groups in stock transfers. + +The stock transfers resulting from the procurement run will only contain +stock moves created in that run. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +1. Go to *Inventory / Configuration / Settings* and check the option + 'Multi-Step Routes' and press the 'Save' button. +2. Activate the developer mode. +3. Go to *Inventory / Configuration / Warehouse Management / Routes* and + select the route you want to change. Select the rule you wish to + change, and in case of a Pull rule or Push & Pull rule Select + 'Propagation of Procurement Group': 'Propagate'. The checkbox + 'Auto-create Procurement Group' will then appear and you can set it + if you want to procurement group to be automatically created. + +Usage +===== + +1. Run a new procurement and make sure that it determines a rule with + the option 'Auto-create Procurement Group' set. +2. When the procurement rule is executed, a procurement group with + format 'PG/000001' will be created. You can find this procurement + group in 'Additional info' tab of a transfer. + +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 +* BCIM + +Contributors +------------ + +- Jordi Ballester +- Lois Rilo +- Héctor Villarreal Ortega +- Jacques-Etienne Baudoux (BCIM) +- Bernat Puig +- Laurent Mignon + +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. + +This module is part of the `OCA/stock-logistics-warehouse `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/procurement_auto_create_group/__init__.py b/procurement_auto_create_group/__init__.py new file mode 100644 index 000000000000..4b76c7b2d5c9 --- /dev/null +++ b/procurement_auto_create_group/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from . import models diff --git a/procurement_auto_create_group/__manifest__.py b/procurement_auto_create_group/__manifest__.py new file mode 100644 index 000000000000..eb83adfb3ca8 --- /dev/null +++ b/procurement_auto_create_group/__manifest__.py @@ -0,0 +1,17 @@ +# Copyright 2017-2020 ForgeFlow, S.L. +# Copyright 2021 Jacques-Etienne Baudoux (BCIM) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +{ + "name": "Procurement Auto Create Group", + "version": "17.0.1.0.0", + "development_status": "Production/Stable", + "license": "AGPL-3", + "summary": "Allows to configure the system to propose automatically new " + "procurement groups during the procurement run.", + "author": "ForgeFlow, BCIM, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/stock-logistics-warehouse", + "category": "Warehouse", + "depends": ["stock"], + "data": ["views/procurement_view.xml"], + "installable": True, +} diff --git a/procurement_auto_create_group/i18n/ca.po b/procurement_auto_create_group/i18n/ca.po new file mode 100644 index 000000000000..4d7f0e763db8 --- /dev/null +++ b/procurement_auto_create_group/i18n/ca.po @@ -0,0 +1,39 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * procurement_auto_create_group +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2022-08-17 12:07+0000\n" +"Last-Translator: jabelchi \n" +"Language-Team: none\n" +"Language: ca\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.3.2\n" + +#. module: procurement_auto_create_group +#: model:ir.model.fields,field_description:procurement_auto_create_group.field_stock_rule__auto_create_group +msgid "Auto-create Procurement Group" +msgstr "Auto crear grup d'abastiment" + +#. module: procurement_auto_create_group +#. odoo-python +#: code:addons/procurement_auto_create_group/models/stock_rule.py:0 +#, python-format +msgid "No sequence defined for procurement group." +msgstr "No s'ha definit seqüència pel grup d'abastiment." + +#. module: procurement_auto_create_group +#: model:ir.model,name:procurement_auto_create_group.model_procurement_group +msgid "Procurement Group" +msgstr "Grup d'abastiment" + +#. module: procurement_auto_create_group +#: model:ir.model,name:procurement_auto_create_group.model_stock_rule +msgid "Stock Rule" +msgstr "Regla d'estoc" diff --git a/procurement_auto_create_group/i18n/cs_CZ.po b/procurement_auto_create_group/i18n/cs_CZ.po new file mode 100644 index 000000000000..db6077e83e1b --- /dev/null +++ b/procurement_auto_create_group/i18n/cs_CZ.po @@ -0,0 +1,50 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * procurement_auto_create_group +# +# Translators: +# Lukáš Spurný , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-02-27 11:37+0000\n" +"PO-Revision-Date: 2018-02-27 11:37+0000\n" +"Last-Translator: Lukáš Spurný , 2018\n" +"Language-Team: Czech (Czech Republic) (https://www.transifex.com/oca/" +"teams/23907/cs_CZ/)\n" +"Language: cs_CZ\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" + +#. module: procurement_auto_create_group +#: model:ir.model.fields,field_description:procurement_auto_create_group.field_stock_rule__auto_create_group +msgid "Auto-create Procurement Group" +msgstr "Automatické vytvoření skupiny nákupu" + +#. module: procurement_auto_create_group +#. odoo-python +#: code:addons/procurement_auto_create_group/models/stock_rule.py:0 +#, fuzzy, python-format +msgid "No sequence defined for procurement group." +msgstr "Nebyla definována žádná sekvence pro skupinu zakázek" + +#. module: procurement_auto_create_group +#: model:ir.model,name:procurement_auto_create_group.model_procurement_group +#, fuzzy +msgid "Procurement Group" +msgstr "Pravidlo zadávání zakázek" + +#. module: procurement_auto_create_group +#: model:ir.model,name:procurement_auto_create_group.model_stock_rule +msgid "Stock Rule" +msgstr "" + +#, fuzzy +#~ msgid "Procurement Requisition" +#~ msgstr "Pravidlo zadávání zakázek" + +#~ msgid "Procurement" +#~ msgstr "Zakázka" diff --git a/procurement_auto_create_group/i18n/de.po b/procurement_auto_create_group/i18n/de.po new file mode 100644 index 000000000000..00e0d04b9bf2 --- /dev/null +++ b/procurement_auto_create_group/i18n/de.po @@ -0,0 +1,50 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * procurement_auto_create_group +# +# Translators: +# OCA Transbot , 2017 +# Rudolf Schnapka , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-06-29 13:12+0000\n" +"PO-Revision-Date: 2017-06-29 13:12+0000\n" +"Last-Translator: Rudolf Schnapka , 2017\n" +"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n" +"Language: de\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" + +#. module: procurement_auto_create_group +#: model:ir.model.fields,field_description:procurement_auto_create_group.field_stock_rule__auto_create_group +msgid "Auto-create Procurement Group" +msgstr "Auto-Anlage Beschaffungsgruppe" + +#. module: procurement_auto_create_group +#. odoo-python +#: code:addons/procurement_auto_create_group/models/stock_rule.py:0 +#, fuzzy, python-format +msgid "No sequence defined for procurement group." +msgstr "Keine Reihenfolge in Beschaffungsgruppe festgelegt" + +#. module: procurement_auto_create_group +#: model:ir.model,name:procurement_auto_create_group.model_procurement_group +#, fuzzy +msgid "Procurement Group" +msgstr "Beschaffungsregel" + +#. module: procurement_auto_create_group +#: model:ir.model,name:procurement_auto_create_group.model_stock_rule +msgid "Stock Rule" +msgstr "" + +#, fuzzy +#~ msgid "Procurement Requisition" +#~ msgstr "Beschaffungsregel" + +#~ msgid "Procurement" +#~ msgstr "Beschaffung" diff --git a/procurement_auto_create_group/i18n/es.po b/procurement_auto_create_group/i18n/es.po new file mode 100644 index 000000000000..d8bf13b047d7 --- /dev/null +++ b/procurement_auto_create_group/i18n/es.po @@ -0,0 +1,59 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * procurement_auto_create_group +# +# Translators: +# OCA Transbot , 2018 +# enjolras , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-02-27 11:37+0000\n" +"PO-Revision-Date: 2023-07-26 22:10+0000\n" +"Last-Translator: Ivorra78 \n" +"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n" +"Language: es\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: procurement_auto_create_group +#: model:ir.model.fields,field_description:procurement_auto_create_group.field_stock_rule__auto_create_group +msgid "Auto-create Procurement Group" +msgstr "Crear grupo de abastecimiento automáticamene" + +#. module: procurement_auto_create_group +#. odoo-python +#: code:addons/procurement_auto_create_group/models/stock_rule.py:0 +#, python-format +msgid "No sequence defined for procurement group." +msgstr "No se ha definido una secuencia para el grupo de abastecimiento." + +#. module: procurement_auto_create_group +#: model:ir.model,name:procurement_auto_create_group.model_procurement_group +msgid "Procurement Group" +msgstr "Grupo de Adquisiciones" + +#. module: procurement_auto_create_group +#: model:ir.model,name:procurement_auto_create_group.model_stock_rule +msgid "Stock Rule" +msgstr "Regla de existencias" + +#~ msgid "Display Name" +#~ msgstr "Nombre a mostrar" + +#~ msgid "ID" +#~ msgstr "ID (identificación)" + +#~ msgid "Last Modified on" +#~ msgstr "Última Modificación el" + +#, fuzzy +#~ msgid "Procurement Requisition" +#~ msgstr "Regla de abastecimiento" + +#~ msgid "Procurement" +#~ msgstr "Abastecimiento" diff --git a/procurement_auto_create_group/i18n/es_MX.po b/procurement_auto_create_group/i18n/es_MX.po new file mode 100644 index 000000000000..082b7d677b18 --- /dev/null +++ b/procurement_auto_create_group/i18n/es_MX.po @@ -0,0 +1,43 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * procurement_auto_create_group +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-06-24 03:04+0000\n" +"PO-Revision-Date: 2017-06-24 03:04+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Spanish (Mexico) (https://www.transifex.com/oca/teams/23907/" +"es_MX/)\n" +"Language: es_MX\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" + +#. module: procurement_auto_create_group +#: model:ir.model.fields,field_description:procurement_auto_create_group.field_stock_rule__auto_create_group +msgid "Auto-create Procurement Group" +msgstr "" + +#. module: procurement_auto_create_group +#. odoo-python +#: code:addons/procurement_auto_create_group/models/stock_rule.py:0 +#, python-format +msgid "No sequence defined for procurement group." +msgstr "" + +#. module: procurement_auto_create_group +#: model:ir.model,name:procurement_auto_create_group.model_procurement_group +#, fuzzy +msgid "Procurement Group" +msgstr "Contratación" + +#. module: procurement_auto_create_group +#: model:ir.model,name:procurement_auto_create_group.model_stock_rule +msgid "Stock Rule" +msgstr "" diff --git a/procurement_auto_create_group/i18n/fr.po b/procurement_auto_create_group/i18n/fr.po new file mode 100644 index 000000000000..57abbc31e582 --- /dev/null +++ b/procurement_auto_create_group/i18n/fr.po @@ -0,0 +1,50 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * procurement_auto_create_group +# +# Translators: +# OCA Transbot , 2018 +# Quentin THEURET , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-02-27 11:37+0000\n" +"PO-Revision-Date: 2019-08-06 14:44+0000\n" +"Last-Translator: Alexandre Fayolle \n" +"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\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.7.1\n" + +#. module: procurement_auto_create_group +#: model:ir.model.fields,field_description:procurement_auto_create_group.field_stock_rule__auto_create_group +msgid "Auto-create Procurement Group" +msgstr "Groupe de l'approvisionnement auto-généré" + +#. module: procurement_auto_create_group +#. odoo-python +#: code:addons/procurement_auto_create_group/models/stock_rule.py:0 +#, python-format +msgid "No sequence defined for procurement group." +msgstr "Pas de séquence définie pour le groupe d'approvisionnements." + +#. module: procurement_auto_create_group +#: model:ir.model,name:procurement_auto_create_group.model_procurement_group +msgid "Procurement Group" +msgstr "Groupe d'approvisionnement" + +#. module: procurement_auto_create_group +#: model:ir.model,name:procurement_auto_create_group.model_stock_rule +msgid "Stock Rule" +msgstr "Règle de stock" + +#, fuzzy +#~ msgid "Procurement Requisition" +#~ msgstr "Règle d'approvisionnement" + +#~ msgid "Procurement" +#~ msgstr "Procurement" diff --git a/procurement_auto_create_group/i18n/hr.po b/procurement_auto_create_group/i18n/hr.po new file mode 100644 index 000000000000..f7af9cba869d --- /dev/null +++ b/procurement_auto_create_group/i18n/hr.po @@ -0,0 +1,51 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * procurement_auto_create_group +# +# Translators: +# OCA Transbot , 2018 +# Bole , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-02-27 11:37+0000\n" +"PO-Revision-Date: 2018-02-27 11:37+0000\n" +"Last-Translator: Bole , 2018\n" +"Language-Team: Croatian (https://www.transifex.com/oca/teams/23907/hr/)\n" +"Language: hr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" + +#. module: procurement_auto_create_group +#: model:ir.model.fields,field_description:procurement_auto_create_group.field_stock_rule__auto_create_group +msgid "Auto-create Procurement Group" +msgstr "Automatski kreiraj grupu nabave" + +#. module: procurement_auto_create_group +#. odoo-python +#: code:addons/procurement_auto_create_group/models/stock_rule.py:0 +#, fuzzy, python-format +msgid "No sequence defined for procurement group." +msgstr "Nema definiranog brojevnog kruga za grupe nabave" + +#. module: procurement_auto_create_group +#: model:ir.model,name:procurement_auto_create_group.model_procurement_group +#, fuzzy +msgid "Procurement Group" +msgstr "Pavilo nabave" + +#. module: procurement_auto_create_group +#: model:ir.model,name:procurement_auto_create_group.model_stock_rule +msgid "Stock Rule" +msgstr "" + +#, fuzzy +#~ msgid "Procurement Requisition" +#~ msgstr "Pavilo nabave" + +#~ msgid "Procurement" +#~ msgstr "Nabava" diff --git a/procurement_auto_create_group/i18n/it.po b/procurement_auto_create_group/i18n/it.po new file mode 100644 index 000000000000..73016cea90c7 --- /dev/null +++ b/procurement_auto_create_group/i18n/it.po @@ -0,0 +1,50 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * procurement_auto_create_group +# +# Translators: +# Paolo Valier , 2017 +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-06-24 03:04+0000\n" +"PO-Revision-Date: 2023-11-21 13:33+0000\n" +"Last-Translator: mymage \n" +"Language-Team: Italian (https://www.transifex.com/oca/teams/23907/it/)\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: procurement_auto_create_group +#: model:ir.model.fields,field_description:procurement_auto_create_group.field_stock_rule__auto_create_group +msgid "Auto-create Procurement Group" +msgstr "Crea automaticamente gruppo di approvvigionamento" + +#. module: procurement_auto_create_group +#. odoo-python +#: code:addons/procurement_auto_create_group/models/stock_rule.py:0 +#, python-format +msgid "No sequence defined for procurement group." +msgstr "Nessuna sequenza definita per il gruppo di approvvigionamento." + +#. module: procurement_auto_create_group +#: model:ir.model,name:procurement_auto_create_group.model_procurement_group +msgid "Procurement Group" +msgstr "Gruppo di approvvigionamento" + +#. module: procurement_auto_create_group +#: model:ir.model,name:procurement_auto_create_group.model_stock_rule +msgid "Stock Rule" +msgstr "Regola di giacenza" + +#, fuzzy +#~ msgid "Procurement Requisition" +#~ msgstr "Regola d'Approvvigionamento" + +#~ msgid "Procurement" +#~ msgstr "Approvvigionamento" diff --git a/procurement_auto_create_group/i18n/procurement_auto_create_group.pot b/procurement_auto_create_group/i18n/procurement_auto_create_group.pot new file mode 100644 index 000000000000..1ba7f6cd3f60 --- /dev/null +++ b/procurement_auto_create_group/i18n/procurement_auto_create_group.pot @@ -0,0 +1,36 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * procurement_auto_create_group +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.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: procurement_auto_create_group +#: model:ir.model.fields,field_description:procurement_auto_create_group.field_stock_rule__auto_create_group +msgid "Auto-create Procurement Group" +msgstr "" + +#. module: procurement_auto_create_group +#. odoo-python +#: code:addons/procurement_auto_create_group/models/stock_rule.py:0 +#, python-format +msgid "No sequence defined for procurement group." +msgstr "" + +#. module: procurement_auto_create_group +#: model:ir.model,name:procurement_auto_create_group.model_procurement_group +msgid "Procurement Group" +msgstr "" + +#. module: procurement_auto_create_group +#: model:ir.model,name:procurement_auto_create_group.model_stock_rule +msgid "Stock Rule" +msgstr "" diff --git a/procurement_auto_create_group/i18n/pt_BR.po b/procurement_auto_create_group/i18n/pt_BR.po new file mode 100644 index 000000000000..7cf5515453a0 --- /dev/null +++ b/procurement_auto_create_group/i18n/pt_BR.po @@ -0,0 +1,44 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * procurement_auto_create_group +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-06-24 03:04+0000\n" +"PO-Revision-Date: 2024-05-22 02:57+0000\n" +"Last-Translator: Rodrigo Macedo \n" +"Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/teams/" +"23907/pt_BR/)\n" +"Language: pt_BR\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: procurement_auto_create_group +#: model:ir.model.fields,field_description:procurement_auto_create_group.field_stock_rule__auto_create_group +msgid "Auto-create Procurement Group" +msgstr "Criar automaticamente grupo de compras" + +#. module: procurement_auto_create_group +#. odoo-python +#: code:addons/procurement_auto_create_group/models/stock_rule.py:0 +#, python-format +msgid "No sequence defined for procurement group." +msgstr "Nenhuma sequência definida para o grupo de compras." + +#. module: procurement_auto_create_group +#: model:ir.model,name:procurement_auto_create_group.model_procurement_group +msgid "Procurement Group" +msgstr "Grupo de Aquisições" + +#. module: procurement_auto_create_group +#: model:ir.model,name:procurement_auto_create_group.model_stock_rule +msgid "Stock Rule" +msgstr "Regra de Estoque" diff --git a/procurement_auto_create_group/i18n/pt_PT.po b/procurement_auto_create_group/i18n/pt_PT.po new file mode 100644 index 000000000000..b022ef26b14c --- /dev/null +++ b/procurement_auto_create_group/i18n/pt_PT.po @@ -0,0 +1,43 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * procurement_auto_create_group +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-06-24 03:04+0000\n" +"PO-Revision-Date: 2017-06-24 03:04+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Portuguese (Portugal) (https://www.transifex.com/oca/" +"teams/23907/pt_PT/)\n" +"Language: pt_PT\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" + +#. module: procurement_auto_create_group +#: model:ir.model.fields,field_description:procurement_auto_create_group.field_stock_rule__auto_create_group +msgid "Auto-create Procurement Group" +msgstr "" + +#. module: procurement_auto_create_group +#. odoo-python +#: code:addons/procurement_auto_create_group/models/stock_rule.py:0 +#, python-format +msgid "No sequence defined for procurement group." +msgstr "" + +#. module: procurement_auto_create_group +#: model:ir.model,name:procurement_auto_create_group.model_procurement_group +#, fuzzy +msgid "Procurement Group" +msgstr "Aquisições" + +#. module: procurement_auto_create_group +#: model:ir.model,name:procurement_auto_create_group.model_stock_rule +msgid "Stock Rule" +msgstr "" diff --git a/procurement_auto_create_group/i18n/ro.po b/procurement_auto_create_group/i18n/ro.po new file mode 100644 index 000000000000..6cb59c40cb89 --- /dev/null +++ b/procurement_auto_create_group/i18n/ro.po @@ -0,0 +1,43 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * procurement_auto_create_group +# +# Translators: +# Dorin Hongu , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-06-24 03:04+0000\n" +"PO-Revision-Date: 2017-06-24 03:04+0000\n" +"Last-Translator: Dorin Hongu , 2017\n" +"Language-Team: Romanian (https://www.transifex.com/oca/teams/23907/ro/)\n" +"Language: ro\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=3; plural=(n==1?0:(((n%100>19)||((n%100==0)&&(n!=0)))?" +"2:1));\n" + +#. module: procurement_auto_create_group +#: model:ir.model.fields,field_description:procurement_auto_create_group.field_stock_rule__auto_create_group +msgid "Auto-create Procurement Group" +msgstr "" + +#. module: procurement_auto_create_group +#. odoo-python +#: code:addons/procurement_auto_create_group/models/stock_rule.py:0 +#, python-format +msgid "No sequence defined for procurement group." +msgstr "" + +#. module: procurement_auto_create_group +#: model:ir.model,name:procurement_auto_create_group.model_procurement_group +#, fuzzy +msgid "Procurement Group" +msgstr "Aprovizionare" + +#. module: procurement_auto_create_group +#: model:ir.model,name:procurement_auto_create_group.model_stock_rule +msgid "Stock Rule" +msgstr "" diff --git a/procurement_auto_create_group/i18n/sk.po b/procurement_auto_create_group/i18n/sk.po new file mode 100644 index 000000000000..acb0c06e8302 --- /dev/null +++ b/procurement_auto_create_group/i18n/sk.po @@ -0,0 +1,42 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * procurement_auto_create_group +# +# Translators: +# Jan Prokop , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-10-03 01:04+0000\n" +"PO-Revision-Date: 2017-10-03 01:04+0000\n" +"Last-Translator: Jan Prokop , 2017\n" +"Language-Team: Slovak (https://www.transifex.com/oca/teams/23907/sk/)\n" +"Language: sk\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" + +#. module: procurement_auto_create_group +#: model:ir.model.fields,field_description:procurement_auto_create_group.field_stock_rule__auto_create_group +msgid "Auto-create Procurement Group" +msgstr "" + +#. module: procurement_auto_create_group +#. odoo-python +#: code:addons/procurement_auto_create_group/models/stock_rule.py:0 +#, python-format +msgid "No sequence defined for procurement group." +msgstr "" + +#. module: procurement_auto_create_group +#: model:ir.model,name:procurement_auto_create_group.model_procurement_group +#, fuzzy +msgid "Procurement Group" +msgstr "Obstarávanie" + +#. module: procurement_auto_create_group +#: model:ir.model,name:procurement_auto_create_group.model_stock_rule +msgid "Stock Rule" +msgstr "" diff --git a/procurement_auto_create_group/i18n/sl.po b/procurement_auto_create_group/i18n/sl.po new file mode 100644 index 000000000000..5e957c1fad8b --- /dev/null +++ b/procurement_auto_create_group/i18n/sl.po @@ -0,0 +1,51 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * procurement_auto_create_group +# +# Translators: +# Matjaž Mozetič , 2017 +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-06-24 03:04+0000\n" +"PO-Revision-Date: 2017-06-24 03:04+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Slovenian (https://www.transifex.com/oca/teams/23907/sl/)\n" +"Language: sl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n" +"%100==4 ? 2 : 3);\n" + +#. module: procurement_auto_create_group +#: model:ir.model.fields,field_description:procurement_auto_create_group.field_stock_rule__auto_create_group +msgid "Auto-create Procurement Group" +msgstr "" + +#. module: procurement_auto_create_group +#. odoo-python +#: code:addons/procurement_auto_create_group/models/stock_rule.py:0 +#, python-format +msgid "No sequence defined for procurement group." +msgstr "" + +#. module: procurement_auto_create_group +#: model:ir.model,name:procurement_auto_create_group.model_procurement_group +#, fuzzy +msgid "Procurement Group" +msgstr "Oskrbovalno pravilo" + +#. module: procurement_auto_create_group +#: model:ir.model,name:procurement_auto_create_group.model_stock_rule +msgid "Stock Rule" +msgstr "" + +#, fuzzy +#~ msgid "Procurement Requisition" +#~ msgstr "Oskrbovalno pravilo" + +#~ msgid "Procurement" +#~ msgstr "Oskrba" diff --git a/procurement_auto_create_group/i18n/tr_TR.po b/procurement_auto_create_group/i18n/tr_TR.po new file mode 100644 index 000000000000..52730b4c2bcc --- /dev/null +++ b/procurement_auto_create_group/i18n/tr_TR.po @@ -0,0 +1,43 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * procurement_auto_create_group +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-06-24 03:04+0000\n" +"PO-Revision-Date: 2017-06-24 03:04+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Turkish (Turkey) (https://www.transifex.com/oca/teams/23907/" +"tr_TR/)\n" +"Language: tr_TR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#. module: procurement_auto_create_group +#: model:ir.model.fields,field_description:procurement_auto_create_group.field_stock_rule__auto_create_group +msgid "Auto-create Procurement Group" +msgstr "" + +#. module: procurement_auto_create_group +#. odoo-python +#: code:addons/procurement_auto_create_group/models/stock_rule.py:0 +#, python-format +msgid "No sequence defined for procurement group." +msgstr "" + +#. module: procurement_auto_create_group +#: model:ir.model,name:procurement_auto_create_group.model_procurement_group +#, fuzzy +msgid "Procurement Group" +msgstr "Satın alma" + +#. module: procurement_auto_create_group +#: model:ir.model,name:procurement_auto_create_group.model_stock_rule +msgid "Stock Rule" +msgstr "" diff --git a/procurement_auto_create_group/i18n/vi_VN.po b/procurement_auto_create_group/i18n/vi_VN.po new file mode 100644 index 000000000000..62e44055e7f5 --- /dev/null +++ b/procurement_auto_create_group/i18n/vi_VN.po @@ -0,0 +1,43 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * procurement_auto_create_group +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-06-24 03:04+0000\n" +"PO-Revision-Date: 2017-06-24 03:04+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Vietnamese (Viet Nam) (https://www.transifex.com/oca/" +"teams/23907/vi_VN/)\n" +"Language: vi_VN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#. module: procurement_auto_create_group +#: model:ir.model.fields,field_description:procurement_auto_create_group.field_stock_rule__auto_create_group +msgid "Auto-create Procurement Group" +msgstr "" + +#. module: procurement_auto_create_group +#. odoo-python +#: code:addons/procurement_auto_create_group/models/stock_rule.py:0 +#, python-format +msgid "No sequence defined for procurement group." +msgstr "" + +#. module: procurement_auto_create_group +#: model:ir.model,name:procurement_auto_create_group.model_procurement_group +#, fuzzy +msgid "Procurement Group" +msgstr "Mua sắm / Cung ứng" + +#. module: procurement_auto_create_group +#: model:ir.model,name:procurement_auto_create_group.model_stock_rule +msgid "Stock Rule" +msgstr "" diff --git a/procurement_auto_create_group/i18n/zh_CN.po b/procurement_auto_create_group/i18n/zh_CN.po new file mode 100644 index 000000000000..2cdc929d7501 --- /dev/null +++ b/procurement_auto_create_group/i18n/zh_CN.po @@ -0,0 +1,43 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * procurement_auto_create_group +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-06-24 03:04+0000\n" +"PO-Revision-Date: 2019-09-19 16:33+0000\n" +"Last-Translator: 黎伟杰 <674416404@qq.com>\n" +"Language-Team: Chinese (China) (https://www.transifex.com/oca/teams/23907/" +"zh_CN/)\n" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Weblate 3.8\n" + +#. module: procurement_auto_create_group +#: model:ir.model.fields,field_description:procurement_auto_create_group.field_stock_rule__auto_create_group +msgid "Auto-create Procurement Group" +msgstr "自动创建补货组" + +#. module: procurement_auto_create_group +#. odoo-python +#: code:addons/procurement_auto_create_group/models/stock_rule.py:0 +#, python-format +msgid "No sequence defined for procurement group." +msgstr "没有为补货组定义序列。" + +#. module: procurement_auto_create_group +#: model:ir.model,name:procurement_auto_create_group.model_procurement_group +msgid "Procurement Group" +msgstr "补货组" + +#. module: procurement_auto_create_group +#: model:ir.model,name:procurement_auto_create_group.model_stock_rule +msgid "Stock Rule" +msgstr "库存规则" diff --git a/procurement_auto_create_group/models/__init__.py b/procurement_auto_create_group/models/__init__.py new file mode 100644 index 000000000000..e2b84e34a9d3 --- /dev/null +++ b/procurement_auto_create_group/models/__init__.py @@ -0,0 +1,4 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from . import stock_rule +from . import procurement_group diff --git a/procurement_auto_create_group/models/procurement_group.py b/procurement_auto_create_group/models/procurement_group.py new file mode 100644 index 000000000000..b94a4cf63e6c --- /dev/null +++ b/procurement_auto_create_group/models/procurement_group.py @@ -0,0 +1,25 @@ +# Copyright 2017-2020 ForgeFlow, S.L. +# Copyright 2021 Jacques-Etienne Baudoux (BCIM) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import api, models + + +class ProcurementGroup(models.Model): + _inherit = "procurement.group" + + @api.model + def _get_rule(self, product_id, location_id, values): + rule = super()._get_rule(product_id, location_id, values) + # If there isn't a date planned in the values it means that this + # method has been called outside of a procurement process. + if ( + rule + and not values.get("group_id") + and rule.auto_create_group + and values.get("date_planned") + ): + group_data = rule._prepare_auto_procurement_group_data() + group = self.env["procurement.group"].create(group_data) + values["group_id"] = group + return rule diff --git a/procurement_auto_create_group/models/stock_rule.py b/procurement_auto_create_group/models/stock_rule.py new file mode 100644 index 000000000000..0933f9c3100c --- /dev/null +++ b/procurement_auto_create_group/models/stock_rule.py @@ -0,0 +1,34 @@ +# Copyright 2017-2020 ForgeFlow, S.L. +# Copyright 2021 Jacques-Etienne Baudoux (BCIM) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import _, api, fields, models +from odoo.exceptions import UserError + + +class StockRule(models.Model): + _inherit = "stock.rule" + + auto_create_group = fields.Boolean(string="Auto-create Procurement Group") + + @api.onchange("group_propagation_option") + def _onchange_group_propagation_option(self): + if self.group_propagation_option != "propagate": + self.auto_create_group = False + + def _push_prepare_move_copy_values(self, move_to_copy, new_date): + new_move_vals = super()._push_prepare_move_copy_values(move_to_copy, new_date) + if self.auto_create_group: + group_data = self._prepare_auto_procurement_group_data() + group = self.env["procurement.group"].create(group_data) + new_move_vals["group_id"] = group.id + return new_move_vals + + def _prepare_auto_procurement_group_data(self): + name = self.env["ir.sequence"].next_by_code("procurement.group") or False + if not name: + raise UserError(_("No sequence defined for procurement group.")) + return { + "name": name, + "partner_id": self.partner_address_id.id, + } diff --git a/procurement_auto_create_group/pyproject.toml b/procurement_auto_create_group/pyproject.toml new file mode 100644 index 000000000000..4231d0cccb3d --- /dev/null +++ b/procurement_auto_create_group/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/procurement_auto_create_group/readme/CONFIGURE.md b/procurement_auto_create_group/readme/CONFIGURE.md new file mode 100644 index 000000000000..53e5fdc67c72 --- /dev/null +++ b/procurement_auto_create_group/readme/CONFIGURE.md @@ -0,0 +1,9 @@ +1. Go to *Inventory / Configuration / Settings* and check the option + 'Multi-Step Routes' and press the 'Save' button. +2. Activate the developer mode. +3. Go to *Inventory / Configuration / Warehouse Management / Routes* + and select the route you want to change. Select the rule you wish to + change, and in case of a Pull rule or Push & Pull rule Select + 'Propagation of Procurement Group': 'Propagate'. The checkbox + 'Auto-create Procurement Group' will then appear and you can set it + if you want to procurement group to be automatically created. diff --git a/procurement_auto_create_group/readme/CONTRIBUTORS.md b/procurement_auto_create_group/readme/CONTRIBUTORS.md new file mode 100644 index 000000000000..528991c599ea --- /dev/null +++ b/procurement_auto_create_group/readme/CONTRIBUTORS.md @@ -0,0 +1,6 @@ +- Jordi Ballester \<\> +- Lois Rilo \<\> +- Héctor Villarreal Ortega \<\> +- Jacques-Etienne Baudoux (BCIM) \<\> +- Bernat Puig \<\> +- Laurent Mignon \<\> diff --git a/procurement_auto_create_group/readme/DESCRIPTION.md b/procurement_auto_create_group/readme/DESCRIPTION.md new file mode 100644 index 000000000000..030a85b21930 --- /dev/null +++ b/procurement_auto_create_group/readme/DESCRIPTION.md @@ -0,0 +1,9 @@ +This module allows the system to propose automatically new procurement +groups during the procurement run. + +This capability is important when you want to make sure that all the +stock moves resulting from a procurement run will never be mixed with +moves from other groups in stock transfers. + +The stock transfers resulting from the procurement run will only contain +stock moves created in that run. diff --git a/procurement_auto_create_group/readme/USAGE.md b/procurement_auto_create_group/readme/USAGE.md new file mode 100644 index 000000000000..c7cc4bf48f67 --- /dev/null +++ b/procurement_auto_create_group/readme/USAGE.md @@ -0,0 +1,5 @@ +1. Run a new procurement and make sure that it determines a rule with + the option 'Auto-create Procurement Group' set. +2. When the procurement rule is executed, a procurement group with + format 'PG/000001' will be created. You can find this procurement + group in 'Additional info' tab of a transfer. diff --git a/procurement_auto_create_group/static/description/icon.png b/procurement_auto_create_group/static/description/icon.png new file mode 100644 index 000000000000..3a0328b516c4 Binary files /dev/null and b/procurement_auto_create_group/static/description/icon.png differ diff --git a/procurement_auto_create_group/static/description/index.html b/procurement_auto_create_group/static/description/index.html new file mode 100644 index 000000000000..fab649016e35 --- /dev/null +++ b/procurement_auto_create_group/static/description/index.html @@ -0,0 +1,461 @@ + + + + + +Procurement Auto Create Group + + + +
+

Procurement Auto Create Group

+ + +

Production/Stable License: AGPL-3 OCA/stock-logistics-warehouse Translate me on Weblate Try me on Runboat

+

This module allows the system to propose automatically new procurement +groups during the procurement run.

+

This capability is important when you want to make sure that all the +stock moves resulting from a procurement run will never be mixed with +moves from other groups in stock transfers.

+

The stock transfers resulting from the procurement run will only contain +stock moves created in that run.

+

Table of contents

+ +
+

Configuration

+
    +
  1. Go to Inventory / Configuration / Settings and check the option +‘Multi-Step Routes’ and press the ‘Save’ button.
  2. +
  3. Activate the developer mode.
  4. +
  5. Go to Inventory / Configuration / Warehouse Management / Routes and +select the route you want to change. Select the rule you wish to +change, and in case of a Pull rule or Push & Pull rule Select +‘Propagation of Procurement Group’: ‘Propagate’. The checkbox +‘Auto-create Procurement Group’ will then appear and you can set it +if you want to procurement group to be automatically created.
  6. +
+
+
+

Usage

+
    +
  1. Run a new procurement and make sure that it determines a rule with +the option ‘Auto-create Procurement Group’ set.
  2. +
  3. When the procurement rule is executed, a procurement group with +format ‘PG/000001’ will be created. You can find this procurement +group in ‘Additional info’ tab of a transfer.
  4. +
+
+
+

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
  • +
  • BCIM
  • +
+
+
+

Contributors

+ +
+
+

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.

+

This module is part of the OCA/stock-logistics-warehouse project on GitHub.

+

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

+
+
+
+ + diff --git a/procurement_auto_create_group/tests/__init__.py b/procurement_auto_create_group/tests/__init__.py new file mode 100644 index 000000000000..682e89fd73ab --- /dev/null +++ b/procurement_auto_create_group/tests/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from . import test_auto_create diff --git a/procurement_auto_create_group/tests/test_auto_create.py b/procurement_auto_create_group/tests/test_auto_create.py new file mode 100644 index 000000000000..b56f95eaf710 --- /dev/null +++ b/procurement_auto_create_group/tests/test_auto_create.py @@ -0,0 +1,241 @@ +# Copyright 2017-2020 ForgeFlow, S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo.tests.common import TransactionCase + + +class TestProcurementAutoCreateGroup(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True)) + cls.group_obj = cls.env["procurement.group"] + cls.rule_obj = cls.env["stock.rule"] + cls.route_obj = cls.env["stock.route"] + cls.move_obj = cls.env["stock.move"] + cls.picking_obj = cls.env["stock.picking"] + cls.product_obj = cls.env["product.product"] + + cls.warehouse = cls.env.ref("stock.warehouse0") + cls.location = cls.env.ref("stock.stock_location_stock") + cls.company_id = cls.env.ref("base.main_company") + cls.supplier_location = cls.env.ref("stock.stock_location_suppliers") + cls.loc_components = cls.env.ref("stock.stock_location_components") + picking_type_id = cls.env.ref("stock.picking_type_internal").id + + cls.partner = cls.env["res.partner"].create({"name": "Partner"}) + + # Create rules and routes: + pull_push_route_auto = cls.route_obj.create({"name": "Auto Create Group"}) + cls.rule_1 = cls.rule_obj.create( + { + "name": "rule with autocreate", + "route_id": pull_push_route_auto.id, + "auto_create_group": True, + "action": "pull_push", + "warehouse_id": cls.warehouse.id, + "picking_type_id": picking_type_id, + "location_dest_id": cls.location.id, + "location_src_id": cls.loc_components.id, + "partner_address_id": cls.partner.id, + } + ) + pull_push_route_no_auto = cls.route_obj.create( + {"name": "Not Auto Create Group"} + ) + cls.rule_obj.create( + { + "name": "rule with no autocreate", + "route_id": pull_push_route_no_auto.id, + "auto_create_group": False, + "action": "pull_push", + "warehouse_id": cls.warehouse.id, + "picking_type_id": picking_type_id, + "location_dest_id": cls.location.id, + "location_src_id": cls.loc_components.id, + } + ) + push_route_auto = cls.route_obj.create({"name": "Auto Create Group"}) + cls.rule_1 = cls.rule_obj.create( + { + "name": "route_auto", + "location_src_id": cls.location.id, + "location_dest_id": cls.loc_components.id, + "route_id": push_route_auto.id, + "auto_create_group": True, + "auto": "manual", + "picking_type_id": picking_type_id, + "warehouse_id": cls.warehouse.id, + "company_id": cls.company_id.id, + "action": "push", + } + ) + push_route_no_auto = cls.route_obj.create({"name": "Not Auto Create Group"}) + cls.rule_obj.create( + { + "name": "route_no_auto", + "location_src_id": cls.location.id, + "location_dest_id": cls.loc_components.id, + "route_id": push_route_no_auto.id, + "auto_create_group": False, + "auto": "manual", + "picking_type_id": picking_type_id, + "warehouse_id": cls.warehouse.id, + "company_id": cls.company_id.id, + "action": "push", + } + ) + + # Prepare products: + cls.prod_auto_pull_push = cls.product_obj.create( + { + "name": "Test Product 1", + "type": "product", + "route_ids": [(6, 0, [pull_push_route_auto.id])], + } + ) + cls.prod_no_auto_pull_push = cls.product_obj.create( + { + "name": "Test Product 2", + "type": "product", + "route_ids": [(6, 0, [pull_push_route_no_auto.id])], + } + ) + cls.prod_auto_push = cls.product_obj.create( + { + "name": "Test Product 3", + "type": "product", + "route_ids": [(6, 0, [push_route_auto.id])], + } + ) + cls.prod_no_auto_push = cls.product_obj.create( + { + "name": "Test Product 4", + "type": "product", + "route_ids": [(6, 0, [push_route_no_auto.id])], + } + ) + + @classmethod + def _procure(cls, product): + values = {} + cls.group_obj.run( + [ + cls.env["procurement.group"].Procurement( + product, + 5.0, + product.uom_id, + cls.location, + "TEST", + "odoo tests", + cls.env.company, + values, + ) + ] + ) + return True + + @classmethod + def _push_trigger(cls, product): + picking = cls.picking_obj.create( + { + "picking_type_id": cls.env.ref("stock.picking_type_in").id, + "location_id": cls.supplier_location.id, + "location_dest_id": cls.location.id, + "move_ids": [ + ( + 0, + 0, + { + "name": "Test move", + "product_id": product.id, + "date_deadline": "2099-06-01 18:00:00", + "date": "2099-06-01 18:00:00", + "product_uom": product.uom_id.id, + "product_uom_qty": 1.0, + "location_id": cls.supplier_location.id, + "location_dest_id": cls.location.id, + }, + ) + ], + } + ) + picking.action_confirm() + picking.move_ids.write({"quantity": 1.0}) + picking.button_validate() + + def test_01_pull_push_no_auto_create_group(self): + """Test auto creation of group.""" + move = self.move_obj.search( + [("product_id", "=", self.prod_no_auto_pull_push.id)] + ) + self.assertFalse(move) + self._procure(self.prod_no_auto_pull_push) + move = self.move_obj.search( + [("product_id", "=", self.prod_no_auto_pull_push.id)] + ) + self.assertTrue(move) + self.assertFalse( + move.group_id, "Procurement Group should not have been assigned." + ) + + def test_02_pull_push_auto_create_group(self): + move = self.move_obj.search([("product_id", "=", self.prod_auto_pull_push.id)]) + self.assertFalse(move) + self._procure(self.prod_auto_pull_push) + move = self.move_obj.search([("product_id", "=", self.prod_auto_pull_push.id)]) + self.assertTrue(move) + self.assertTrue(move.group_id, "Procurement Group not assigned.") + self.assertEqual( + move.group_id.partner_id, + self.partner, + "Procurement Group partner missing.", + ) + + def test_03_onchange_method(self): + """Test onchange method for stock rule.""" + proc_rule = self.rule_1 + self.assertTrue(proc_rule.auto_create_group) + proc_rule.write({"group_propagation_option": "none"}) + proc_rule._onchange_group_propagation_option() + self.assertFalse(proc_rule.auto_create_group) + + def test_04_push_no_auto_create_group(self): + """Test no auto creation of group.""" + move = self.move_obj.search( + [ + ("product_id", "=", self.prod_no_auto_push.id), + ("location_dest_id", "=", self.loc_components.id), + ] + ) + self.assertFalse(move) + self._push_trigger(self.prod_no_auto_push) + move = self.move_obj.search( + [ + ("product_id", "=", self.prod_no_auto_push.id), + ("location_dest_id", "=", self.loc_components.id), + ] + ) + self.assertTrue(move) + self.assertFalse( + move.group_id, "Procurement Group should not have been assigned." + ) + + def test_05_push_auto_create_group(self): + """Test auto creation of group.""" + move = self.move_obj.search( + [ + ("product_id", "=", self.prod_auto_push.id), + ("location_dest_id", "=", self.loc_components.id), + ] + ) + self.assertFalse(move) + self._push_trigger(self.prod_auto_push) + move = self.move_obj.search( + [ + ("product_id", "=", self.prod_auto_push.id), + ("location_dest_id", "=", self.loc_components.id), + ] + ) + self.assertTrue(move) + self.assertTrue(move.group_id, "Procurement Group not assigned.") diff --git a/procurement_auto_create_group/views/procurement_view.xml b/procurement_auto_create_group/views/procurement_view.xml new file mode 100644 index 000000000000..987f98be2ec2 --- /dev/null +++ b/procurement_auto_create_group/views/procurement_view.xml @@ -0,0 +1,19 @@ + + + + stock.rule.form - procurement_auto_create_group + stock.rule + + + + + + + + + + +