diff --git a/stock_removal_location_by_priority/README.rst b/stock_removal_location_by_priority/README.rst new file mode 100644 index 000000000..ff539abd0 --- /dev/null +++ b/stock_removal_location_by_priority/README.rst @@ -0,0 +1,102 @@ +================================== +Stock Removal Location by Priority +================================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-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/13.0/stock_removal_location_by_priority + :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-13-0/stock-logistics-warehouse-13-0-stock_removal_location_by_priority + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/153/13.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module adds a removal priority field on stock locations. +This priority applies when removing a product from different stock locations +and the incoming dates are equal in both locations. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +You can activate the removal priority as follows: + +#. Go to "Inventory > Configuration > Settings" +#. In 'Operations' section, mark the "Removal Priority" option. +#. You also need to activate the following settings in the section *Warehouse* if they are not yet: + + #. Manage several locations using *Storage Locations* option. + #. Advanced routing using "Multi-Step Routes" option. + +Then, set the *Removal Priority* in the desired locations. Remember that a +lower number means more priority: + +#. Go to "Inventory > Configuration > Warehouse Management > Locations" +#. In each Location form, in the Logistics section, put a Removal Priority. + +Usage +===== + +After configure your locations properly, the system will select the quant +at the location with more priority in case of equal date, no matter if you +use FIFO or LIFO removal strategy. + +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 smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Eficent + +Contributors +~~~~~~~~~~~~ + +* Miquel Raïch +* Lois Rilo +* Pimolnat Suntian + +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/stock_removal_location_by_priority/__init__.py b/stock_removal_location_by_priority/__init__.py new file mode 100644 index 000000000..a2aff3e43 --- /dev/null +++ b/stock_removal_location_by_priority/__init__.py @@ -0,0 +1,4 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from . import models +from .init_hook import pre_init_hook diff --git a/stock_removal_location_by_priority/__manifest__.py b/stock_removal_location_by_priority/__manifest__.py new file mode 100644 index 000000000..60589aea6 --- /dev/null +++ b/stock_removal_location_by_priority/__manifest__.py @@ -0,0 +1,21 @@ +# Copyright 2017 Eficent Business and IT Consulting Services S.L. +# (http://www.eficent.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +{ + "name": "Stock Removal Location by Priority", + "summary": "Establish a removal priority on stock locations.", + "version": "13.0.1.0.0", + "author": "Eficent, " "Odoo Community Association (OCA)", + "website": "https://github.com/OCA/stock-logistics-warehouse", + "category": "Warehouse", + "depends": ["stock"], + "data": [ + "security/stock_security.xml", + "views/res_config_settings_views.xml", + "views/stock_location_view.xml", + ], + "license": "AGPL-3", + "installable": True, + "application": False, + "pre_init_hook": "pre_init_hook", +} diff --git a/stock_removal_location_by_priority/i18n/de.po b/stock_removal_location_by_priority/i18n/de.po new file mode 100644 index 000000000..3eaa751ae --- /dev/null +++ b/stock_removal_location_by_priority/i18n/de.po @@ -0,0 +1,67 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_removal_location_by_priority +# +# 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-05-31 02:38+0000\n" +"PO-Revision-Date: 2017-05-31 02:38+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: stock_removal_location_by_priority +#: model:ir.model,name:stock_removal_location_by_priority.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: stock_removal_location_by_priority +#: model:ir.model,name:stock_removal_location_by_priority.model_stock_location +msgid "Inventory Locations" +msgstr "Bestandslagerorte" + +#. module: stock_removal_location_by_priority +#: model:ir.model,name:stock_removal_location_by_priority.model_stock_quant +msgid "Quants" +msgstr "Quants" + +#. module: stock_removal_location_by_priority +#: model:ir.model.fields,field_description:stock_removal_location_by_priority.field_res_config_settings__group_removal_priority +#: model:ir.model.fields,field_description:stock_removal_location_by_priority.field_stock_location__removal_priority +#: model:ir.model.fields,field_description:stock_removal_location_by_priority.field_stock_quant__removal_priority +#: model:res.groups,name:stock_removal_location_by_priority.group_removal_priority +msgid "Removal Priority" +msgstr "" + +#. module: stock_removal_location_by_priority +#: model:ir.model.fields,help:stock_removal_location_by_priority.field_res_config_settings__group_removal_priority +msgid "" +"Removal priority that applies when the incoming dates are equal in both " +"locations." +msgstr "" + +#. module: stock_removal_location_by_priority +#: code:addons/stock_removal_location_by_priority/models/stock_quant.py:25 +#, python-format +msgid "Removal strategy %s not implemented." +msgstr "" + +#. module: stock_removal_location_by_priority +#: model:ir.model.fields,help:stock_removal_location_by_priority.field_stock_location__removal_priority +#: model:ir.model.fields,help:stock_removal_location_by_priority.field_stock_quant__removal_priority +msgid "This priority applies when removing stock and incoming dates are equal." +msgstr "" + +#. module: stock_removal_location_by_priority +#: model_terms:ir.ui.view,arch_db:stock_removal_location_by_priority.view_stock_config_settings +msgid "Use Removal Priority in Locations" +msgstr "" diff --git a/stock_removal_location_by_priority/i18n/es.po b/stock_removal_location_by_priority/i18n/es.po new file mode 100644 index 000000000..a3c690116 --- /dev/null +++ b/stock_removal_location_by_priority/i18n/es.po @@ -0,0 +1,67 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_removal_location_by_priority +# +# Translators: +# OCA Transbot , 2017 +# Antonio Trueba , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-05-31 02:38+0000\n" +"PO-Revision-Date: 2017-05-31 02:38+0000\n" +"Last-Translator: Antonio Trueba , 2017\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" + +#. module: stock_removal_location_by_priority +#: model:ir.model,name:stock_removal_location_by_priority.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: stock_removal_location_by_priority +#: model:ir.model,name:stock_removal_location_by_priority.model_stock_location +msgid "Inventory Locations" +msgstr "Ubicaciones de inventario" + +#. module: stock_removal_location_by_priority +#: model:ir.model,name:stock_removal_location_by_priority.model_stock_quant +msgid "Quants" +msgstr "Quants" + +#. module: stock_removal_location_by_priority +#: model:ir.model.fields,field_description:stock_removal_location_by_priority.field_res_config_settings__group_removal_priority +#: model:ir.model.fields,field_description:stock_removal_location_by_priority.field_stock_location__removal_priority +#: model:ir.model.fields,field_description:stock_removal_location_by_priority.field_stock_quant__removal_priority +#: model:res.groups,name:stock_removal_location_by_priority.group_removal_priority +msgid "Removal Priority" +msgstr "" + +#. module: stock_removal_location_by_priority +#: model:ir.model.fields,help:stock_removal_location_by_priority.field_res_config_settings__group_removal_priority +msgid "" +"Removal priority that applies when the incoming dates are equal in both " +"locations." +msgstr "" + +#. module: stock_removal_location_by_priority +#: code:addons/stock_removal_location_by_priority/models/stock_quant.py:25 +#, python-format +msgid "Removal strategy %s not implemented." +msgstr "" + +#. module: stock_removal_location_by_priority +#: model:ir.model.fields,help:stock_removal_location_by_priority.field_stock_location__removal_priority +#: model:ir.model.fields,help:stock_removal_location_by_priority.field_stock_quant__removal_priority +msgid "This priority applies when removing stock and incoming dates are equal." +msgstr "" + +#. module: stock_removal_location_by_priority +#: model_terms:ir.ui.view,arch_db:stock_removal_location_by_priority.view_stock_config_settings +msgid "Use Removal Priority in Locations" +msgstr "" diff --git a/stock_removal_location_by_priority/i18n/fi.po b/stock_removal_location_by_priority/i18n/fi.po new file mode 100644 index 000000000..8b8683c3d --- /dev/null +++ b/stock_removal_location_by_priority/i18n/fi.po @@ -0,0 +1,66 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_removal_location_by_priority +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-05-31 02:38+0000\n" +"PO-Revision-Date: 2017-05-31 02:38+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Finnish (https://www.transifex.com/oca/teams/23907/fi/)\n" +"Language: fi\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: stock_removal_location_by_priority +#: model:ir.model,name:stock_removal_location_by_priority.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: stock_removal_location_by_priority +#: model:ir.model,name:stock_removal_location_by_priority.model_stock_location +msgid "Inventory Locations" +msgstr "" + +#. module: stock_removal_location_by_priority +#: model:ir.model,name:stock_removal_location_by_priority.model_stock_quant +msgid "Quants" +msgstr "Määrät" + +#. module: stock_removal_location_by_priority +#: model:ir.model.fields,field_description:stock_removal_location_by_priority.field_res_config_settings__group_removal_priority +#: model:ir.model.fields,field_description:stock_removal_location_by_priority.field_stock_location__removal_priority +#: model:ir.model.fields,field_description:stock_removal_location_by_priority.field_stock_quant__removal_priority +#: model:res.groups,name:stock_removal_location_by_priority.group_removal_priority +msgid "Removal Priority" +msgstr "" + +#. module: stock_removal_location_by_priority +#: model:ir.model.fields,help:stock_removal_location_by_priority.field_res_config_settings__group_removal_priority +msgid "" +"Removal priority that applies when the incoming dates are equal in both " +"locations." +msgstr "" + +#. module: stock_removal_location_by_priority +#: code:addons/stock_removal_location_by_priority/models/stock_quant.py:25 +#, python-format +msgid "Removal strategy %s not implemented." +msgstr "" + +#. module: stock_removal_location_by_priority +#: model:ir.model.fields,help:stock_removal_location_by_priority.field_stock_location__removal_priority +#: model:ir.model.fields,help:stock_removal_location_by_priority.field_stock_quant__removal_priority +msgid "This priority applies when removing stock and incoming dates are equal." +msgstr "" + +#. module: stock_removal_location_by_priority +#: model_terms:ir.ui.view,arch_db:stock_removal_location_by_priority.view_stock_config_settings +msgid "Use Removal Priority in Locations" +msgstr "" diff --git a/stock_removal_location_by_priority/i18n/fr.po b/stock_removal_location_by_priority/i18n/fr.po new file mode 100644 index 000000000..5ea0bff5e --- /dev/null +++ b/stock_removal_location_by_priority/i18n/fr.po @@ -0,0 +1,70 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_removal_location_by_priority +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-05-31 02:38+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: stock_removal_location_by_priority +#: model:ir.model,name:stock_removal_location_by_priority.model_res_config_settings +msgid "Config Settings" +msgstr "Configuration" + +#. module: stock_removal_location_by_priority +#: model:ir.model,name:stock_removal_location_by_priority.model_stock_location +msgid "Inventory Locations" +msgstr "Emplacements de stock" + +#. module: stock_removal_location_by_priority +#: model:ir.model,name:stock_removal_location_by_priority.model_stock_quant +msgid "Quants" +msgstr "Quants" + +#. module: stock_removal_location_by_priority +#: model:ir.model.fields,field_description:stock_removal_location_by_priority.field_res_config_settings__group_removal_priority +#: model:ir.model.fields,field_description:stock_removal_location_by_priority.field_stock_location__removal_priority +#: model:ir.model.fields,field_description:stock_removal_location_by_priority.field_stock_quant__removal_priority +#: model:res.groups,name:stock_removal_location_by_priority.group_removal_priority +msgid "Removal Priority" +msgstr "Priorité pour les sorties de stock" + +#. module: stock_removal_location_by_priority +#: model:ir.model.fields,help:stock_removal_location_by_priority.field_res_config_settings__group_removal_priority +msgid "" +"Removal priority that applies when the incoming dates are equal in both " +"locations." +msgstr "" +"Priorité appliquée lors des dates d'entrée sont égales pour 2 emplacements." + +#. module: stock_removal_location_by_priority +#: code:addons/stock_removal_location_by_priority/models/stock_quant.py:25 +#, python-format +msgid "Removal strategy %s not implemented." +msgstr "La stratégie d'enlèvement %s n'est pas codée." + +#. module: stock_removal_location_by_priority +#: model:ir.model.fields,help:stock_removal_location_by_priority.field_stock_location__removal_priority +#: model:ir.model.fields,help:stock_removal_location_by_priority.field_stock_quant__removal_priority +msgid "This priority applies when removing stock and incoming dates are equal." +msgstr "" +"Cette priorité s'applique lors de sorties de stock, lorsque les dates " +"d'entrées des articles sont égales." + +#. module: stock_removal_location_by_priority +#: model_terms:ir.ui.view,arch_db:stock_removal_location_by_priority.view_stock_config_settings +msgid "Use Removal Priority in Locations" +msgstr "Utiliser une Priorité de sortie sur les emplacements" diff --git a/stock_removal_location_by_priority/i18n/it.po b/stock_removal_location_by_priority/i18n/it.po new file mode 100644 index 000000000..f5f4f7cb2 --- /dev/null +++ b/stock_removal_location_by_priority/i18n/it.po @@ -0,0 +1,66 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_removal_location_by_priority +# +# Translators: +# Paolo Valier , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-05-31 02:38+0000\n" +"PO-Revision-Date: 2017-05-31 02:38+0000\n" +"Last-Translator: Paolo Valier , 2017\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" + +#. module: stock_removal_location_by_priority +#: model:ir.model,name:stock_removal_location_by_priority.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: stock_removal_location_by_priority +#: model:ir.model,name:stock_removal_location_by_priority.model_stock_location +msgid "Inventory Locations" +msgstr "" + +#. module: stock_removal_location_by_priority +#: model:ir.model,name:stock_removal_location_by_priority.model_stock_quant +msgid "Quants" +msgstr "Quantità" + +#. module: stock_removal_location_by_priority +#: model:ir.model.fields,field_description:stock_removal_location_by_priority.field_res_config_settings__group_removal_priority +#: model:ir.model.fields,field_description:stock_removal_location_by_priority.field_stock_location__removal_priority +#: model:ir.model.fields,field_description:stock_removal_location_by_priority.field_stock_quant__removal_priority +#: model:res.groups,name:stock_removal_location_by_priority.group_removal_priority +msgid "Removal Priority" +msgstr "" + +#. module: stock_removal_location_by_priority +#: model:ir.model.fields,help:stock_removal_location_by_priority.field_res_config_settings__group_removal_priority +msgid "" +"Removal priority that applies when the incoming dates are equal in both " +"locations." +msgstr "" + +#. module: stock_removal_location_by_priority +#: code:addons/stock_removal_location_by_priority/models/stock_quant.py:25 +#, python-format +msgid "Removal strategy %s not implemented." +msgstr "" + +#. module: stock_removal_location_by_priority +#: model:ir.model.fields,help:stock_removal_location_by_priority.field_stock_location__removal_priority +#: model:ir.model.fields,help:stock_removal_location_by_priority.field_stock_quant__removal_priority +msgid "This priority applies when removing stock and incoming dates are equal." +msgstr "" + +#. module: stock_removal_location_by_priority +#: model_terms:ir.ui.view,arch_db:stock_removal_location_by_priority.view_stock_config_settings +msgid "Use Removal Priority in Locations" +msgstr "" diff --git a/stock_removal_location_by_priority/i18n/pt_BR.po b/stock_removal_location_by_priority/i18n/pt_BR.po new file mode 100644 index 000000000..cbfaeb690 --- /dev/null +++ b/stock_removal_location_by_priority/i18n/pt_BR.po @@ -0,0 +1,67 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_removal_location_by_priority +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-05-31 02:38+0000\n" +"PO-Revision-Date: 2017-05-31 02:38+0000\n" +"Last-Translator: OCA Transbot , 2017\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" + +#. module: stock_removal_location_by_priority +#: model:ir.model,name:stock_removal_location_by_priority.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: stock_removal_location_by_priority +#: model:ir.model,name:stock_removal_location_by_priority.model_stock_location +msgid "Inventory Locations" +msgstr "" + +#. module: stock_removal_location_by_priority +#: model:ir.model,name:stock_removal_location_by_priority.model_stock_quant +msgid "Quants" +msgstr "Quants" + +#. module: stock_removal_location_by_priority +#: model:ir.model.fields,field_description:stock_removal_location_by_priority.field_res_config_settings__group_removal_priority +#: model:ir.model.fields,field_description:stock_removal_location_by_priority.field_stock_location__removal_priority +#: model:ir.model.fields,field_description:stock_removal_location_by_priority.field_stock_quant__removal_priority +#: model:res.groups,name:stock_removal_location_by_priority.group_removal_priority +msgid "Removal Priority" +msgstr "" + +#. module: stock_removal_location_by_priority +#: model:ir.model.fields,help:stock_removal_location_by_priority.field_res_config_settings__group_removal_priority +msgid "" +"Removal priority that applies when the incoming dates are equal in both " +"locations." +msgstr "" + +#. module: stock_removal_location_by_priority +#: code:addons/stock_removal_location_by_priority/models/stock_quant.py:25 +#, python-format +msgid "Removal strategy %s not implemented." +msgstr "" + +#. module: stock_removal_location_by_priority +#: model:ir.model.fields,help:stock_removal_location_by_priority.field_stock_location__removal_priority +#: model:ir.model.fields,help:stock_removal_location_by_priority.field_stock_quant__removal_priority +msgid "This priority applies when removing stock and incoming dates are equal." +msgstr "" + +#. module: stock_removal_location_by_priority +#: model_terms:ir.ui.view,arch_db:stock_removal_location_by_priority.view_stock_config_settings +msgid "Use Removal Priority in Locations" +msgstr "" diff --git a/stock_removal_location_by_priority/i18n/ro.po b/stock_removal_location_by_priority/i18n/ro.po new file mode 100644 index 000000000..fc3700506 --- /dev/null +++ b/stock_removal_location_by_priority/i18n/ro.po @@ -0,0 +1,67 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_removal_location_by_priority +# +# Translators: +# Dorin Hongu , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-05-31 02:38+0000\n" +"PO-Revision-Date: 2017-05-31 02:38+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: stock_removal_location_by_priority +#: model:ir.model,name:stock_removal_location_by_priority.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: stock_removal_location_by_priority +#: model:ir.model,name:stock_removal_location_by_priority.model_stock_location +msgid "Inventory Locations" +msgstr "" + +#. module: stock_removal_location_by_priority +#: model:ir.model,name:stock_removal_location_by_priority.model_stock_quant +msgid "Quants" +msgstr "Poziții de stoc" + +#. module: stock_removal_location_by_priority +#: model:ir.model.fields,field_description:stock_removal_location_by_priority.field_res_config_settings__group_removal_priority +#: model:ir.model.fields,field_description:stock_removal_location_by_priority.field_stock_location__removal_priority +#: model:ir.model.fields,field_description:stock_removal_location_by_priority.field_stock_quant__removal_priority +#: model:res.groups,name:stock_removal_location_by_priority.group_removal_priority +msgid "Removal Priority" +msgstr "" + +#. module: stock_removal_location_by_priority +#: model:ir.model.fields,help:stock_removal_location_by_priority.field_res_config_settings__group_removal_priority +msgid "" +"Removal priority that applies when the incoming dates are equal in both " +"locations." +msgstr "" + +#. module: stock_removal_location_by_priority +#: code:addons/stock_removal_location_by_priority/models/stock_quant.py:25 +#, python-format +msgid "Removal strategy %s not implemented." +msgstr "" + +#. module: stock_removal_location_by_priority +#: model:ir.model.fields,help:stock_removal_location_by_priority.field_stock_location__removal_priority +#: model:ir.model.fields,help:stock_removal_location_by_priority.field_stock_quant__removal_priority +msgid "This priority applies when removing stock and incoming dates are equal." +msgstr "" + +#. module: stock_removal_location_by_priority +#: model_terms:ir.ui.view,arch_db:stock_removal_location_by_priority.view_stock_config_settings +msgid "Use Removal Priority in Locations" +msgstr "" diff --git a/stock_removal_location_by_priority/i18n/sl.po b/stock_removal_location_by_priority/i18n/sl.po new file mode 100644 index 000000000..2c1542aba --- /dev/null +++ b/stock_removal_location_by_priority/i18n/sl.po @@ -0,0 +1,68 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_removal_location_by_priority +# +# Translators: +# OCA Transbot , 2017 +# Matjaž Mozetič , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-05-31 02:38+0000\n" +"PO-Revision-Date: 2017-05-31 02:38+0000\n" +"Last-Translator: Matjaž Mozetič , 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: stock_removal_location_by_priority +#: model:ir.model,name:stock_removal_location_by_priority.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: stock_removal_location_by_priority +#: model:ir.model,name:stock_removal_location_by_priority.model_stock_location +msgid "Inventory Locations" +msgstr "Lokacije inventarja" + +#. module: stock_removal_location_by_priority +#: model:ir.model,name:stock_removal_location_by_priority.model_stock_quant +msgid "Quants" +msgstr "Kvant" + +#. module: stock_removal_location_by_priority +#: model:ir.model.fields,field_description:stock_removal_location_by_priority.field_res_config_settings__group_removal_priority +#: model:ir.model.fields,field_description:stock_removal_location_by_priority.field_stock_location__removal_priority +#: model:ir.model.fields,field_description:stock_removal_location_by_priority.field_stock_quant__removal_priority +#: model:res.groups,name:stock_removal_location_by_priority.group_removal_priority +msgid "Removal Priority" +msgstr "" + +#. module: stock_removal_location_by_priority +#: model:ir.model.fields,help:stock_removal_location_by_priority.field_res_config_settings__group_removal_priority +msgid "" +"Removal priority that applies when the incoming dates are equal in both " +"locations." +msgstr "" + +#. module: stock_removal_location_by_priority +#: code:addons/stock_removal_location_by_priority/models/stock_quant.py:25 +#, python-format +msgid "Removal strategy %s not implemented." +msgstr "" + +#. module: stock_removal_location_by_priority +#: model:ir.model.fields,help:stock_removal_location_by_priority.field_stock_location__removal_priority +#: model:ir.model.fields,help:stock_removal_location_by_priority.field_stock_quant__removal_priority +msgid "This priority applies when removing stock and incoming dates are equal." +msgstr "" + +#. module: stock_removal_location_by_priority +#: model_terms:ir.ui.view,arch_db:stock_removal_location_by_priority.view_stock_config_settings +msgid "Use Removal Priority in Locations" +msgstr "" diff --git a/stock_removal_location_by_priority/i18n/stock_removal_location_by_priority.pot b/stock_removal_location_by_priority/i18n/stock_removal_location_by_priority.pot new file mode 100644 index 000000000..777b7dfbd --- /dev/null +++ b/stock_removal_location_by_priority/i18n/stock_removal_location_by_priority.pot @@ -0,0 +1,60 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_removal_location_by_priority +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.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: stock_removal_location_by_priority +#: model:ir.model,name:stock_removal_location_by_priority.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: stock_removal_location_by_priority +#: model:ir.model,name:stock_removal_location_by_priority.model_stock_location +msgid "Inventory Locations" +msgstr "" + +#. module: stock_removal_location_by_priority +#: model:ir.model,name:stock_removal_location_by_priority.model_stock_quant +msgid "Quants" +msgstr "" + +#. module: stock_removal_location_by_priority +#: model:ir.model.fields,field_description:stock_removal_location_by_priority.field_res_config_settings__group_removal_priority +#: model:ir.model.fields,field_description:stock_removal_location_by_priority.field_stock_location__removal_priority +#: model:ir.model.fields,field_description:stock_removal_location_by_priority.field_stock_quant__removal_priority +#: model:res.groups,name:stock_removal_location_by_priority.group_removal_priority +msgid "Removal Priority" +msgstr "" + +#. module: stock_removal_location_by_priority +#: model:ir.model.fields,help:stock_removal_location_by_priority.field_res_config_settings__group_removal_priority +msgid "Removal priority that applies when the incoming dates are equal in both locations." +msgstr "" + +#. module: stock_removal_location_by_priority +#: code:addons/stock_removal_location_by_priority/models/stock_quant.py:25 +#, python-format +msgid "Removal strategy %s not implemented." +msgstr "" + +#. module: stock_removal_location_by_priority +#: model:ir.model.fields,help:stock_removal_location_by_priority.field_stock_location__removal_priority +#: model:ir.model.fields,help:stock_removal_location_by_priority.field_stock_quant__removal_priority +msgid "This priority applies when removing stock and incoming dates are equal." +msgstr "" + +#. module: stock_removal_location_by_priority +#: model_terms:ir.ui.view,arch_db:stock_removal_location_by_priority.view_stock_config_settings +msgid "Use Removal Priority in Locations" +msgstr "" + diff --git a/stock_removal_location_by_priority/i18n/zh_CN.po b/stock_removal_location_by_priority/i18n/zh_CN.po new file mode 100644 index 000000000..dab3bb25f --- /dev/null +++ b/stock_removal_location_by_priority/i18n/zh_CN.po @@ -0,0 +1,68 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_removal_location_by_priority +# +# Translators: +# liAnGjiA , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-05-31 02:38+0000\n" +"PO-Revision-Date: 2019-10-16 16:05+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: stock_removal_location_by_priority +#: model:ir.model,name:stock_removal_location_by_priority.model_res_config_settings +msgid "Config Settings" +msgstr "配置设定" + +#. module: stock_removal_location_by_priority +#: model:ir.model,name:stock_removal_location_by_priority.model_stock_location +msgid "Inventory Locations" +msgstr "库存位置" + +#. module: stock_removal_location_by_priority +#: model:ir.model,name:stock_removal_location_by_priority.model_stock_quant +msgid "Quants" +msgstr "数量分析" + +#. module: stock_removal_location_by_priority +#: model:ir.model.fields,field_description:stock_removal_location_by_priority.field_res_config_settings__group_removal_priority +#: model:ir.model.fields,field_description:stock_removal_location_by_priority.field_stock_location__removal_priority +#: model:ir.model.fields,field_description:stock_removal_location_by_priority.field_stock_quant__removal_priority +#: model:res.groups,name:stock_removal_location_by_priority.group_removal_priority +msgid "Removal Priority" +msgstr "移除优先级" + +#. module: stock_removal_location_by_priority +#: model:ir.model.fields,help:stock_removal_location_by_priority.field_res_config_settings__group_removal_priority +msgid "" +"Removal priority that applies when the incoming dates are equal in both " +"locations." +msgstr "当两个位置的传入日期相等时,将应用删除优先级。" + +#. module: stock_removal_location_by_priority +#: code:addons/stock_removal_location_by_priority/models/stock_quant.py:25 +#, python-format +msgid "Removal strategy %s not implemented." +msgstr "未执行删除策略%s。" + +#. module: stock_removal_location_by_priority +#: model:ir.model.fields,help:stock_removal_location_by_priority.field_stock_location__removal_priority +#: model:ir.model.fields,help:stock_removal_location_by_priority.field_stock_quant__removal_priority +msgid "This priority applies when removing stock and incoming dates are equal." +msgstr "当删除库存且输入日期相等时,将应用此优先级。" + +#. module: stock_removal_location_by_priority +#: model_terms:ir.ui.view,arch_db:stock_removal_location_by_priority.view_stock_config_settings +msgid "Use Removal Priority in Locations" +msgstr "使用 移除优先级 位置" diff --git a/stock_removal_location_by_priority/init_hook.py b/stock_removal_location_by_priority/init_hook.py new file mode 100644 index 000000000..9f4c58fdb --- /dev/null +++ b/stock_removal_location_by_priority/init_hook.py @@ -0,0 +1,54 @@ +# Copyright 2017 Eficent Business and IT Consulting Services, S.L. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +import logging + +logger = logging.getLogger(__name__) + + +def pre_init_hook(cr): + """ + The objective of this hook is to speed up the installation + of the module on an existing Odoo instance. + + Without this script, big databases can take a long time to install this + module. + """ + set_stock_location_removal_priority_default(cr) + set_stock_quant_removal_priority_default(cr) + + +def set_stock_location_removal_priority_default(cr): + cr.execute( + """SELECT column_name + FROM information_schema.columns + WHERE table_name='stock_location' AND + column_name='removal_priority'""" + ) + if not cr.fetchone(): + logger.info("Creating field removal_priority on stock_location") + cr.execute( + """ + ALTER TABLE stock_location + ADD COLUMN removal_priority integer + DEFAULT 10; + """ + ) + + +def set_stock_quant_removal_priority_default(cr): + cr.execute( + """SELECT column_name + FROM information_schema.columns + WHERE table_name='stock_quant' AND + column_name='removal_priority'""" + ) + if not cr.fetchone(): + logger.info("Creating field removal_priority on stock_quant") + cr.execute( + """ + ALTER TABLE stock_quant + ADD COLUMN removal_priority integer + DEFAULT 10; + """ + ) diff --git a/stock_removal_location_by_priority/models/__init__.py b/stock_removal_location_by_priority/models/__init__.py new file mode 100644 index 000000000..fad922206 --- /dev/null +++ b/stock_removal_location_by_priority/models/__init__.py @@ -0,0 +1,5 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from . import res_config_settings +from . import stock_location +from . import stock_quant diff --git a/stock_removal_location_by_priority/models/res_config_settings.py b/stock_removal_location_by_priority/models/res_config_settings.py new file mode 100644 index 000000000..08839c08f --- /dev/null +++ b/stock_removal_location_by_priority/models/res_config_settings.py @@ -0,0 +1,16 @@ +# Copyright 2017-18 Eficent Business and IT Consulting Services S.L. +# (http://www.eficent.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + group_removal_priority = fields.Boolean( + string="Removal Priority", + implied_group="stock_removal_location_by_priority.group_removal_priority", + help="Removal priority that applies when the incoming dates " + "are equal in both locations.", + ) diff --git a/stock_removal_location_by_priority/models/stock_location.py b/stock_removal_location_by_priority/models/stock_location.py new file mode 100644 index 000000000..ec9f4c8bd --- /dev/null +++ b/stock_removal_location_by_priority/models/stock_location.py @@ -0,0 +1,15 @@ +# Copyright 2017 Eficent Business and IT Consulting Services S.L. +# (http://www.eficent.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class StockLocation(models.Model): + _inherit = "stock.location" + + removal_priority = fields.Integer( + string="Removal Priority", + default=10, + help="This priority applies when removing stock and incoming dates are equal.", + ) diff --git a/stock_removal_location_by_priority/models/stock_quant.py b/stock_removal_location_by_priority/models/stock_quant.py new file mode 100644 index 000000000..5879581aa --- /dev/null +++ b/stock_removal_location_by_priority/models/stock_quant.py @@ -0,0 +1,28 @@ +# Copyright 2017-18 Eficent Business and IT Consulting Services S.L. +# (http://www.eficent.com) +# 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 StockQuant(models.Model): + _inherit = "stock.quant" + + removal_priority = fields.Integer( + related="location_id.removal_priority", store=True + ) + + @api.model + def _get_removal_strategy_order(self, removal_strategy): + if self.user_has_groups( + "stock_removal_location_by_priority.group_removal_priority" + ): + if removal_strategy == "fifo": + return "in_date ASC NULLS FIRST, removal_priority ASC, id" + elif removal_strategy == "lifo": + return "in_date DESC NULLS LAST, removal_priority ASC, id desc" + raise UserError( + _("Removal strategy %s not implemented.") % (removal_strategy,) + ) + return super(StockQuant, self)._get_removal_strategy_order(removal_strategy) diff --git a/stock_removal_location_by_priority/readme/CONFIGURE.rst b/stock_removal_location_by_priority/readme/CONFIGURE.rst new file mode 100644 index 000000000..c160586be --- /dev/null +++ b/stock_removal_location_by_priority/readme/CONFIGURE.rst @@ -0,0 +1,14 @@ +You can activate the removal priority as follows: + +#. Go to "Inventory > Configuration > Settings" +#. In 'Operations' section, mark the "Removal Priority" option. +#. You also need to activate the following settings in the section *Warehouse* if they are not yet: + + #. Manage several locations using *Storage Locations* option. + #. Advanced routing using "Multi-Step Routes" option. + +Then, set the *Removal Priority* in the desired locations. Remember that a +lower number means more priority: + +#. Go to "Inventory > Configuration > Warehouse Management > Locations" +#. In each Location form, in the Logistics section, put a Removal Priority. diff --git a/stock_removal_location_by_priority/readme/CONTRIBUTORS.rst b/stock_removal_location_by_priority/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..ee08c1532 --- /dev/null +++ b/stock_removal_location_by_priority/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* Miquel Raïch +* Lois Rilo +* Pimolnat Suntian diff --git a/stock_removal_location_by_priority/readme/DESCRIPTION.rst b/stock_removal_location_by_priority/readme/DESCRIPTION.rst new file mode 100644 index 000000000..11aa2cb8b --- /dev/null +++ b/stock_removal_location_by_priority/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +This module adds a removal priority field on stock locations. +This priority applies when removing a product from different stock locations +and the incoming dates are equal in both locations. diff --git a/stock_removal_location_by_priority/readme/USAGE.rst b/stock_removal_location_by_priority/readme/USAGE.rst new file mode 100644 index 000000000..94c9ee303 --- /dev/null +++ b/stock_removal_location_by_priority/readme/USAGE.rst @@ -0,0 +1,3 @@ +After configure your locations properly, the system will select the quant +at the location with more priority in case of equal date, no matter if you +use FIFO or LIFO removal strategy. diff --git a/stock_removal_location_by_priority/security/stock_security.xml b/stock_removal_location_by_priority/security/stock_security.xml new file mode 100644 index 000000000..7a49c05e5 --- /dev/null +++ b/stock_removal_location_by_priority/security/stock_security.xml @@ -0,0 +1,12 @@ + + + + + + + Removal Priority + + + + diff --git a/stock_removal_location_by_priority/static/description/icon.png b/stock_removal_location_by_priority/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/stock_removal_location_by_priority/static/description/icon.png differ diff --git a/stock_removal_location_by_priority/static/description/index.html b/stock_removal_location_by_priority/static/description/index.html new file mode 100644 index 000000000..a3512e411 --- /dev/null +++ b/stock_removal_location_by_priority/static/description/index.html @@ -0,0 +1,450 @@ + + + + + + +Stock Removal Location by Priority + + + +
+

Stock Removal Location by Priority

+ + +

Beta License: AGPL-3 OCA/stock-logistics-warehouse Translate me on Weblate Try me on Runbot

+

This module adds a removal priority field on stock locations. +This priority applies when removing a product from different stock locations +and the incoming dates are equal in both locations.

+

Table of contents

+ +
+

Configuration

+

You can activate the removal priority as follows:

+
    +
  1. Go to “Inventory > Configuration > Settings”
  2. +
  3. In ‘Operations’ section, mark the “Removal Priority” option.
  4. +
  5. You also need to activate the following settings in the section Warehouse if they are not yet:
      +
    1. Manage several locations using Storage Locations option.
    2. +
    3. Advanced routing using “Multi-Step Routes” option.
    4. +
    +
  6. +
+

Then, set the Removal Priority in the desired locations. Remember that a +lower number means more priority:

+
    +
  1. Go to “Inventory > Configuration > Warehouse Management > Locations”
  2. +
  3. In each Location form, in the Logistics section, put a Removal Priority.
  4. +
+
+
+

Usage

+

After configure your locations properly, the system will select the quant +at the location with more priority in case of equal date, no matter if you +use FIFO or LIFO removal strategy.

+
+
+

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 smashing it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Eficent
  • +
+
+
+

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/stock_removal_location_by_priority/tests/__init__.py b/stock_removal_location_by_priority/tests/__init__.py new file mode 100644 index 000000000..fec5b5e00 --- /dev/null +++ b/stock_removal_location_by_priority/tests/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from . import test_stock_removal_location_by_priority diff --git a/stock_removal_location_by_priority/tests/test_stock_removal_location_by_priority.py b/stock_removal_location_by_priority/tests/test_stock_removal_location_by_priority.py new file mode 100644 index 000000000..6c41ba155 --- /dev/null +++ b/stock_removal_location_by_priority/tests/test_stock_removal_location_by_priority.py @@ -0,0 +1,163 @@ +# Copyright 2017-18 Eficent Business and IT Consulting Services S.L. +# (http://www.eficent.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from datetime import date + +from odoo.tests.common import TransactionCase + + +class TestStockRemovalLocationByPriority(TransactionCase): + def setUp(self): + super(TestStockRemovalLocationByPriority, self).setUp() + self.res_users_model = self.env["res.users"] + self.stock_location_model = self.env["stock.location"] + self.stock_warehouse_model = self.env["stock.warehouse"] + self.stock_picking_model = self.env["stock.picking"] + self.stock_change_model = self.env["stock.change.product.qty"] + self.product_model = self.env["product.product"] + self.quant_model = self.env["stock.quant"] + + self.picking_internal = self.env.ref("stock.picking_type_internal") + self.picking_out = self.env.ref("stock.picking_type_out") + self.location_supplier = self.env.ref("stock.stock_location_suppliers") + + self.company = self.env.ref("base.main_company") + grp_rem_priority = self.env.ref( + "stock_removal_location_by_priority.group_removal_priority" + ) + + # We assign the group to admin, as the _get_removal_strategy_order + # method is going to be always executed as sudo. + user_admin = self.env.ref("base.user_root") + user_admin.groups_id = [(4, grp_rem_priority.id, 0)] + + self.wh1 = self.stock_warehouse_model.create({"name": "WH1", "code": "WH1"}) + + # Removal strategies: + self.fifo = self.env.ref("stock.removal_fifo") + self.lifo = self.env.ref("stock.removal_lifo") + + # Create locations: + self.stock = self.stock_location_model.create( + {"name": "Stock Base", "usage": "internal"} + ) + self.shelf_A = self.stock_location_model.create( + { + "name": "Shelf_A", + "usage": "internal", + "location_id": self.stock.id, + "removal_priority": 10, + } + ) + self.shelf_B = self.stock_location_model.create( + { + "name": "Shelf_B", + "usage": "internal", + "location_id": self.stock.id, + "removal_priority": 5, + } + ) + self.stock_2 = self.stock_location_model.create( + {"name": "Another Stock Location", "usage": "internal"} + ) + + # Create a product: + self.product_1 = self.product_model.create( + {"name": "Test Product 1", "type": "product"} + ) + + # Create quants: + today = date.today() + q1 = self.quant_model.create( + { + "product_id": self.product_1.id, + "location_id": self.shelf_A.id, + "quantity": 5.0, + "in_date": today, + } + ) + q2 = self.quant_model.create( + { + "product_id": self.product_1.id, + "location_id": self.shelf_B.id, + "quantity": 5.0, + "in_date": today, + } + ) + self.quants = q1 + q2 + + def _create_picking(self, picking_type, location, location_dest, qty): + picking = self.stock_picking_model.create( + { + "picking_type_id": picking_type.id, + "location_id": location.id, + "location_dest_id": location_dest.id, + "move_lines": [ + ( + 0, + 0, + { + "name": "Test move", + "product_id": self.product_1.id, + "product_uom": self.product_1.uom_id.id, + "product_uom_qty": qty, + "location_id": location.id, + "location_dest_id": location_dest.id, + "price_unit": 2, + }, + ) + ], + } + ) + return picking + + def test_01_stock_removal_location_by_priority_fifo(self): + """Tests removal priority with FIFO strategy.""" + self.stock.removal_strategy_id = self.fifo + # quants must start unreserved + for q in self.quants: + self.assertEqual(q.reserved_quantity, 0.0) + if q.location_id == self.shelf_A: + self.assertEqual(q.removal_priority, 10) + if q.location_id == self.shelf_B: + self.assertEqual(q.removal_priority, 5) + self.assertEqual(self.quants[0].in_date, self.quants[1].in_date) + picking_1 = self._create_picking( + self.picking_internal, self.stock, self.stock_2, 5 + ) + picking_1.flush() + picking_1.action_confirm() + picking_1.action_assign() + + # quants must be reserved in Shelf B (lower removal_priority value). + for q in self.quants: + if q.location_id == self.shelf_A: + self.assertEqual(q.reserved_quantity, 0.0) + if q.location_id == self.shelf_B: + self.assertEqual(q.reserved_quantity, 5.0) + + def test_02_stock_removal_location_by_priority_lifo(self): + """Tests removal priority with LIFO strategy.""" + self.stock.removal_strategy_id = self.lifo + # quants must start unreserved + for q in self.quants: + self.assertEqual(q.reserved_quantity, 0.0) + if q.location_id == self.shelf_A: + self.assertEqual(q.removal_priority, 10) + if q.location_id == self.shelf_B: + self.assertEqual(q.removal_priority, 5) + self.assertEqual(self.quants[0].in_date, self.quants[1].in_date) + picking_1 = self._create_picking( + self.picking_internal, self.stock, self.stock_2, 5 + ) + picking_1.flush() + picking_1.action_confirm() + picking_1.action_assign() + + # quants must be reserved in Shelf B (lower removal_priority value). + for q in self.quants: + if q.location_id == self.shelf_A: + self.assertEqual(q.reserved_quantity, 0.0) + if q.location_id == self.shelf_B: + self.assertEqual(q.reserved_quantity, 5.0) diff --git a/stock_removal_location_by_priority/views/res_config_settings_views.xml b/stock_removal_location_by_priority/views/res_config_settings_views.xml new file mode 100644 index 000000000..8e721744a --- /dev/null +++ b/stock_removal_location_by_priority/views/res_config_settings_views.xml @@ -0,0 +1,27 @@ + + + + + + res.config.settings - removal_priority + res.config.settings + + + +
+
+ +
+
+
+
+
+
+
+ +
diff --git a/stock_removal_location_by_priority/views/stock_location_view.xml b/stock_removal_location_by_priority/views/stock_location_view.xml new file mode 100644 index 000000000..deef32a81 --- /dev/null +++ b/stock_removal_location_by_priority/views/stock_location_view.xml @@ -0,0 +1,18 @@ + + + + + + + Location form - removal priority extension + stock.location + + + + + + + + +