diff --git a/stock_move_line_auto_fill/README.rst b/stock_move_line_auto_fill/README.rst new file mode 100644 index 00000000000..4ede4a64105 --- /dev/null +++ b/stock_move_line_auto_fill/README.rst @@ -0,0 +1,141 @@ +========================= +Stock Move Line Auto Fill +========================= + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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--workflow-lightgray.png?logo=github + :target: https://github.com/OCA/stock-logistics-workflow/tree/12.0/stock_move_line_auto_fill + :alt: OCA/stock-logistics-workflow +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/stock-logistics-workflow-12-0/stock-logistics-workflow-12-0-stock_move_line_auto_fill + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/154/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module alows to auto fill quantities in picking operations and autoassignment +lots quantities. + +In Odoo, if you schedule to transfer 50 products and only receive 49, you have +to change the quantity directly on the picking. +As the quantity by default is 0 for each line, you have to write the received +quantity on 49 lines. + +In this module we have added a button that helps users to fill automatically +the scheduled quantities. Then, the user can just change back the quantities +for the product that hasn't been received yet. + +Products with lots +================== +When working with lots, it's very uncomfortable to introduce the quantity, +lot by lot, when transferring pickings from your warehouse (outgoing or +internal). + +This module automatically assigns the reserved quantity as the done one, so +that you only have to change it in case of divergence, but having the +possibility of transferring directly. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +To configure this module, you need to: + +#. Make sure you have selected the proper removal strategy on your product + categories. +#. Configure the product on the page "Inventory", field "Tracking" with one of + these values: "By Unique Serial Number" or "By Lots" if you want autoassign + lots. +#. Check in Operation type if you want auto assign quantities, by default if + you want assign quantities done to reserved quantities you must push the + button "Auto Fill" when the picking is in ready state and has move lines +#. Check in Operation type if you do not want auto assign lots quantities with + "Avoid auto-assignment of lots". + +Usage +===== + +Set options in operation types, you can set 'Auto fill operation' what make +autoassignment button invisible and fill the quantities in operations for lines +and 'Avoid Autoassignment Lots' what allow fill manually the lots quantities. + +Products without tracking lots +============================== +After confirming the picking, click on `Auto fill operations` button. The +Operations matching the following conditions will be filled automatically: + +* The operation has not be processed (i.e `qty_done == 0`). +* The operation has no package set (i.e `package_id` is empty). + +Product with lots +================= +#. Create an outgoing or an internal picking. +#. Include one product with lots and with enough stock. +#. Click on "Mark as Todo" button, and then on "Reserve". +#. Clicking on the icon with the three items bullet list on the "Operations" + tab you will see that the quantities have been auto-assigned on the "Done" + column. + +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 +~~~~~~~ + +* ACSONE SA/NV +* Tecnativa + +Contributors +~~~~~~~~~~~~ + +* Zakaria Makrelouf (ACSONE SA/NV) +* Luis Triana (Jarsa Sistemas de S.A. de C.V.) +* `Tecnativa `_: + * Pedro M. Baeza + * Vicent Cubells + * Sergio Teruel + * David Vidal +* Jaime Arroyo (Creu Blanca) + +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-workflow `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/stock_move_line_auto_fill/__init__.py b/stock_move_line_auto_fill/__init__.py new file mode 100644 index 00000000000..69f7babdfb1 --- /dev/null +++ b/stock_move_line_auto_fill/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import models diff --git a/stock_move_line_auto_fill/__manifest__.py b/stock_move_line_auto_fill/__manifest__.py new file mode 100644 index 00000000000..c5f545aa635 --- /dev/null +++ b/stock_move_line_auto_fill/__manifest__.py @@ -0,0 +1,21 @@ +# Copyright 2017 ACSONE SA/NV +# Copyright 2018 Tecnativa - Sergio Teruel +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + 'name': 'Stock Move Line Auto Fill', + 'summary': "Stock Move Line auto fill", + 'version': '12.0.2.0.1', + 'license': 'AGPL-3', + 'author': 'ACSONE SA/NV,' + 'Tecnativa,' + 'Odoo Community Association (OCA)', + 'website': 'https://github.com/OCA/stock-logistics-workflow/', + 'depends': [ + 'stock', + ], + 'data': [ + 'views/stock_picking.xml', + 'views/stock_picking_type_views.xml', + ], +} diff --git a/stock_move_line_auto_fill/i18n/cs_CZ.po b/stock_move_line_auto_fill/i18n/cs_CZ.po new file mode 100644 index 00000000000..441079e6294 --- /dev/null +++ b/stock_move_line_auto_fill/i18n/cs_CZ.po @@ -0,0 +1,75 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_pack_operation_auto_fill +# +# Translators: +# Lukáš Spurný , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-02-28 08:51+0000\n" +"PO-Revision-Date: 2018-02-28 08:51+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: stock_pack_operation_auto_fill +#: model:ir.model.fields,field_description:stock_pack_operation_auto_fill.field_stock_picking_action_pack_op_auto_fill_allowed +msgid "Action Pack Op Auto Fill Allowed" +msgstr "Možnost automatického vyplnění akce pack op" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model.fields,field_description:stock_pack_operation_auto_fill.field_stock_picking_auto_fill_operation +#: model:ir.model.fields,field_description:stock_pack_operation_auto_fill.field_stock_picking_type_auto_fill_operation +msgid "Auto fill operations" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.ui.view,arch_db:stock_pack_operation_auto_fill.stock_picking_form_view +msgid "AutoFill" +msgstr "Automatické vyplňování" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model.fields,field_description:stock_pack_operation_auto_fill.field_stock_picking_type_avoid_lot_assignment +msgid "Avoid auto-assignment of lots" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: code:addons/stock_pack_operation_auto_fill/models/stock_picking.py:36 +#, python-format +msgid "" +"Filling the operations automatically is not possible, perhaps the pickings " +"aren't in the right state (Partially available or available)." +msgstr "" +"Automatické vyplňování operací není možné, sběrnice pravděpodobně nejsou ve " +"správném stavu (částečně dostupné nebo dostupné)." + +#. module: stock_pack_operation_auto_fill +#: model:ir.model,name:stock_pack_operation_auto_fill.model_stock_move +msgid "Stock Move" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model,name:stock_pack_operation_auto_fill.model_stock_picking_type +msgid "The operation type determines the picking view" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.ui.view,arch_db:stock_pack_operation_auto_fill.stock_picking_form_view +msgid "" +"This button will automatically fill all operations that have no tracking set " +"on the product, no processed qty and no selected package." +msgstr "" +"Toto tlačítko automaticky vyplní všechny operace, které nemají na produktu " +"žádný sledovací soubor, žádné zpracované množství a žádný vybraný balíček." + +#. module: stock_pack_operation_auto_fill +#: model:ir.model,name:stock_pack_operation_auto_fill.model_stock_picking +msgid "Transfer" +msgstr "Převod" diff --git a/stock_move_line_auto_fill/i18n/de.po b/stock_move_line_auto_fill/i18n/de.po new file mode 100644 index 00000000000..9dc5139ac45 --- /dev/null +++ b/stock_move_line_auto_fill/i18n/de.po @@ -0,0 +1,70 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_pack_operation_auto_fill +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-12-03 03:55+0000\n" +"PO-Revision-Date: 2017-12-03 03:55+0000\n" +"Last-Translator: OCA Transbot , 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_pack_operation_auto_fill +#: model:ir.model.fields,field_description:stock_pack_operation_auto_fill.field_stock_picking_action_pack_op_auto_fill_allowed +msgid "Action Pack Op Auto Fill Allowed" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model.fields,field_description:stock_pack_operation_auto_fill.field_stock_picking_auto_fill_operation +#: model:ir.model.fields,field_description:stock_pack_operation_auto_fill.field_stock_picking_type_auto_fill_operation +msgid "Auto fill operations" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.ui.view,arch_db:stock_pack_operation_auto_fill.stock_picking_form_view +msgid "AutoFill" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model.fields,field_description:stock_pack_operation_auto_fill.field_stock_picking_type_avoid_lot_assignment +msgid "Avoid auto-assignment of lots" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: code:addons/stock_pack_operation_auto_fill/models/stock_picking.py:36 +#, python-format +msgid "" +"Filling the operations automatically is not possible, perhaps the pickings " +"aren't in the right state (Partially available or available)." +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model,name:stock_pack_operation_auto_fill.model_stock_move +msgid "Stock Move" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model,name:stock_pack_operation_auto_fill.model_stock_picking_type +msgid "The operation type determines the picking view" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.ui.view,arch_db:stock_pack_operation_auto_fill.stock_picking_form_view +msgid "" +"This button will automatically fill all operations that have no tracking set " +"on the product, no processed qty and no selected package." +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model,name:stock_pack_operation_auto_fill.model_stock_picking +msgid "Transfer" +msgstr "Lieferung vornehmen" diff --git a/stock_move_line_auto_fill/i18n/es.po b/stock_move_line_auto_fill/i18n/es.po new file mode 100644 index 00000000000..13ccf6a0ccb --- /dev/null +++ b/stock_move_line_auto_fill/i18n/es.po @@ -0,0 +1,80 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_pack_operation_auto_fill +# +# Translators: +# OCA Transbot , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-06-13 17:12+0200\n" +"PO-Revision-Date: 2018-06-13 17:13+0200\n" +"Last-Translator: OCA Transbot , 2018\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: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 1.8.7.1\n" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model.fields,field_description:stock_pack_operation_auto_fill.field_stock_picking_action_pack_op_auto_fill_allowed +msgid "Action Pack Op Auto Fill Allowed" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model.fields,field_description:stock_pack_operation_auto_fill.field_stock_picking_auto_fill_operation +#: model:ir.model.fields,field_description:stock_pack_operation_auto_fill.field_stock_picking_type_auto_fill_operation +msgid "Auto fill operations" +msgstr "Autocompletar operaciones" + +#. module: stock_pack_operation_auto_fill +#: model:ir.ui.view,arch_db:stock_pack_operation_auto_fill.stock_picking_form_view +msgid "AutoFill" +msgstr "Autocompletar" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model.fields,field_description:stock_pack_operation_auto_fill.field_stock_picking_type_avoid_lot_assignment +msgid "Avoid auto-assignment of lots" +msgstr "Evitar asignación automática de lotes" + +#. module: stock_pack_operation_auto_fill +#: code:addons/stock_pack_operation_auto_fill/models/stock_picking.py:36 +#, python-format +msgid "" +"Filling the operations automatically is not possible, perhaps the pickings " +"aren't in the right state (Partially available or available)." +msgstr "" +"Llenar las operaciosn de forma automática no es posible, posiblemente los " +"movimientos no están en el estado correcto (Parcialmente disponible o " +"Disponible)." + +#. module: stock_pack_operation_auto_fill +#: model:ir.model,name:stock_pack_operation_auto_fill.model_stock_move +msgid "Stock Move" +msgstr "Movimiento de stock" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model,name:stock_pack_operation_auto_fill.model_stock_picking_type +msgid "The operation type determines the picking view" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.ui.view,arch_db:stock_pack_operation_auto_fill.stock_picking_form_view +msgid "" +"This button will automatically fill all operations that have no tracking set " +"on the product, no processed qty and no selected package." +msgstr "" +"Este botón va a llenar todas las operaciones de forma automática, si no " +"tienen activada la trazabilidad en el producto, ninguna cantidad procesada y " +"ningún paquete seleccionado." + +#. module: stock_pack_operation_auto_fill +#: model:ir.model,name:stock_pack_operation_auto_fill.model_stock_picking +msgid "Transfer" +msgstr "Transferir" + +#~ msgid "The picking type determines the picking view" +#~ msgstr "El tipo de albarán determina la vista de albarán" diff --git a/stock_move_line_auto_fill/i18n/fr.po b/stock_move_line_auto_fill/i18n/fr.po new file mode 100644 index 00000000000..f04e7e0e080 --- /dev/null +++ b/stock_move_line_auto_fill/i18n/fr.po @@ -0,0 +1,77 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_pack_operation_auto_fill +# +# Translators: +# OCA Transbot , 2018 +# Quentin THEURET , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-02-28 08:51+0000\n" +"PO-Revision-Date: 2018-02-28 08:51+0000\n" +"Last-Translator: Quentin THEURET , 2018\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" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model.fields,field_description:stock_pack_operation_auto_fill.field_stock_picking_action_pack_op_auto_fill_allowed +msgid "Action Pack Op Auto Fill Allowed" +msgstr "Action Pack Op Auto Fill Allowed" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model.fields,field_description:stock_pack_operation_auto_fill.field_stock_picking_auto_fill_operation +#: model:ir.model.fields,field_description:stock_pack_operation_auto_fill.field_stock_picking_type_auto_fill_operation +msgid "Auto fill operations" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.ui.view,arch_db:stock_pack_operation_auto_fill.stock_picking_form_view +msgid "AutoFill" +msgstr "Remplissage automatique" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model.fields,field_description:stock_pack_operation_auto_fill.field_stock_picking_type_avoid_lot_assignment +msgid "Avoid auto-assignment of lots" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: code:addons/stock_pack_operation_auto_fill/models/stock_picking.py:36 +#, python-format +msgid "" +"Filling the operations automatically is not possible, perhaps the pickings " +"aren't in the right state (Partially available or available)." +msgstr "" +"Remplir les opérations automatiquement n'est pas possible, peut-être que les " +"opérations de stock ne sont pas dans le bon état (partiellement disponible " +"ou disponible)" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model,name:stock_pack_operation_auto_fill.model_stock_move +msgid "Stock Move" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model,name:stock_pack_operation_auto_fill.model_stock_picking_type +msgid "The operation type determines the picking view" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.ui.view,arch_db:stock_pack_operation_auto_fill.stock_picking_form_view +msgid "" +"This button will automatically fill all operations that have no tracking set " +"on the product, no processed qty and no selected package." +msgstr "" +"Ce bouton va automatiquement remplir toutes les opérations qui n'ont pas de " +"suivi renseigné sur le produit, pas de quantité traitée et pas de paquet " +"sélectionné." + +#. module: stock_pack_operation_auto_fill +#: model:ir.model,name:stock_pack_operation_auto_fill.model_stock_picking +msgid "Transfer" +msgstr "Transfert" diff --git a/stock_move_line_auto_fill/i18n/it.po b/stock_move_line_auto_fill/i18n/it.po new file mode 100644 index 00000000000..7238bcb5521 --- /dev/null +++ b/stock_move_line_auto_fill/i18n/it.po @@ -0,0 +1,70 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_pack_operation_auto_fill +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-12-03 03:55+0000\n" +"PO-Revision-Date: 2017-12-03 03:55+0000\n" +"Last-Translator: OCA Transbot , 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_pack_operation_auto_fill +#: model:ir.model.fields,field_description:stock_pack_operation_auto_fill.field_stock_picking_action_pack_op_auto_fill_allowed +msgid "Action Pack Op Auto Fill Allowed" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model.fields,field_description:stock_pack_operation_auto_fill.field_stock_picking_auto_fill_operation +#: model:ir.model.fields,field_description:stock_pack_operation_auto_fill.field_stock_picking_type_auto_fill_operation +msgid "Auto fill operations" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.ui.view,arch_db:stock_pack_operation_auto_fill.stock_picking_form_view +msgid "AutoFill" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model.fields,field_description:stock_pack_operation_auto_fill.field_stock_picking_type_avoid_lot_assignment +msgid "Avoid auto-assignment of lots" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: code:addons/stock_pack_operation_auto_fill/models/stock_picking.py:36 +#, python-format +msgid "" +"Filling the operations automatically is not possible, perhaps the pickings " +"aren't in the right state (Partially available or available)." +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model,name:stock_pack_operation_auto_fill.model_stock_move +msgid "Stock Move" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model,name:stock_pack_operation_auto_fill.model_stock_picking_type +msgid "The operation type determines the picking view" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.ui.view,arch_db:stock_pack_operation_auto_fill.stock_picking_form_view +msgid "" +"This button will automatically fill all operations that have no tracking set " +"on the product, no processed qty and no selected package." +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model,name:stock_pack_operation_auto_fill.model_stock_picking +msgid "Transfer" +msgstr "Trasferisci" diff --git a/stock_move_line_auto_fill/i18n/nl_NL.po b/stock_move_line_auto_fill/i18n/nl_NL.po new file mode 100644 index 00000000000..e474e19a2b2 --- /dev/null +++ b/stock_move_line_auto_fill/i18n/nl_NL.po @@ -0,0 +1,71 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_pack_operation_auto_fill +# +# Translators: +# Peter Hageman , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-12-03 03:55+0000\n" +"PO-Revision-Date: 2017-12-03 03:55+0000\n" +"Last-Translator: Peter Hageman , 2017\n" +"Language-Team: Dutch (Netherlands) (https://www.transifex.com/oca/" +"teams/23907/nl_NL/)\n" +"Language: nl_NL\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_pack_operation_auto_fill +#: model:ir.model.fields,field_description:stock_pack_operation_auto_fill.field_stock_picking_action_pack_op_auto_fill_allowed +msgid "Action Pack Op Auto Fill Allowed" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model.fields,field_description:stock_pack_operation_auto_fill.field_stock_picking_auto_fill_operation +#: model:ir.model.fields,field_description:stock_pack_operation_auto_fill.field_stock_picking_type_auto_fill_operation +msgid "Auto fill operations" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.ui.view,arch_db:stock_pack_operation_auto_fill.stock_picking_form_view +msgid "AutoFill" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model.fields,field_description:stock_pack_operation_auto_fill.field_stock_picking_type_avoid_lot_assignment +msgid "Avoid auto-assignment of lots" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: code:addons/stock_pack_operation_auto_fill/models/stock_picking.py:36 +#, python-format +msgid "" +"Filling the operations automatically is not possible, perhaps the pickings " +"aren't in the right state (Partially available or available)." +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model,name:stock_pack_operation_auto_fill.model_stock_move +msgid "Stock Move" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model,name:stock_pack_operation_auto_fill.model_stock_picking_type +msgid "The operation type determines the picking view" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.ui.view,arch_db:stock_pack_operation_auto_fill.stock_picking_form_view +msgid "" +"This button will automatically fill all operations that have no tracking set " +"on the product, no processed qty and no selected package." +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model,name:stock_pack_operation_auto_fill.model_stock_picking +msgid "Transfer" +msgstr "Verplaats" diff --git a/stock_move_line_auto_fill/i18n/pt.po b/stock_move_line_auto_fill/i18n/pt.po new file mode 100644 index 00000000000..ff66fe8dd7d --- /dev/null +++ b/stock_move_line_auto_fill/i18n/pt.po @@ -0,0 +1,70 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_pack_operation_auto_fill +# +# Translators: +# Pedro Castro Silva , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-12-18 03:48+0000\n" +"PO-Revision-Date: 2017-12-18 03:48+0000\n" +"Last-Translator: Pedro Castro Silva , 2017\n" +"Language-Team: Portuguese (https://www.transifex.com/oca/teams/23907/pt/)\n" +"Language: 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: stock_pack_operation_auto_fill +#: model:ir.model.fields,field_description:stock_pack_operation_auto_fill.field_stock_picking_action_pack_op_auto_fill_allowed +msgid "Action Pack Op Auto Fill Allowed" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model.fields,field_description:stock_pack_operation_auto_fill.field_stock_picking_auto_fill_operation +#: model:ir.model.fields,field_description:stock_pack_operation_auto_fill.field_stock_picking_type_auto_fill_operation +msgid "Auto fill operations" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.ui.view,arch_db:stock_pack_operation_auto_fill.stock_picking_form_view +msgid "AutoFill" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model.fields,field_description:stock_pack_operation_auto_fill.field_stock_picking_type_avoid_lot_assignment +msgid "Avoid auto-assignment of lots" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: code:addons/stock_pack_operation_auto_fill/models/stock_picking.py:36 +#, python-format +msgid "" +"Filling the operations automatically is not possible, perhaps the pickings " +"aren't in the right state (Partially available or available)." +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model,name:stock_pack_operation_auto_fill.model_stock_move +msgid "Stock Move" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model,name:stock_pack_operation_auto_fill.model_stock_picking_type +msgid "The operation type determines the picking view" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.ui.view,arch_db:stock_pack_operation_auto_fill.stock_picking_form_view +msgid "" +"This button will automatically fill all operations that have no tracking set " +"on the product, no processed qty and no selected package." +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model,name:stock_pack_operation_auto_fill.model_stock_picking +msgid "Transfer" +msgstr "Transferência" diff --git a/stock_move_line_auto_fill/i18n/pt_BR.po b/stock_move_line_auto_fill/i18n/pt_BR.po new file mode 100644 index 00000000000..7ee26c1219a --- /dev/null +++ b/stock_move_line_auto_fill/i18n/pt_BR.po @@ -0,0 +1,71 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_pack_operation_auto_fill +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-12-03 03:55+0000\n" +"PO-Revision-Date: 2017-12-03 03:55+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_pack_operation_auto_fill +#: model:ir.model.fields,field_description:stock_pack_operation_auto_fill.field_stock_picking_action_pack_op_auto_fill_allowed +msgid "Action Pack Op Auto Fill Allowed" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model.fields,field_description:stock_pack_operation_auto_fill.field_stock_picking_auto_fill_operation +#: model:ir.model.fields,field_description:stock_pack_operation_auto_fill.field_stock_picking_type_auto_fill_operation +msgid "Auto fill operations" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.ui.view,arch_db:stock_pack_operation_auto_fill.stock_picking_form_view +msgid "AutoFill" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model.fields,field_description:stock_pack_operation_auto_fill.field_stock_picking_type_avoid_lot_assignment +msgid "Avoid auto-assignment of lots" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: code:addons/stock_pack_operation_auto_fill/models/stock_picking.py:36 +#, python-format +msgid "" +"Filling the operations automatically is not possible, perhaps the pickings " +"aren't in the right state (Partially available or available)." +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model,name:stock_pack_operation_auto_fill.model_stock_move +msgid "Stock Move" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model,name:stock_pack_operation_auto_fill.model_stock_picking_type +msgid "The operation type determines the picking view" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.ui.view,arch_db:stock_pack_operation_auto_fill.stock_picking_form_view +msgid "" +"This button will automatically fill all operations that have no tracking set " +"on the product, no processed qty and no selected package." +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model,name:stock_pack_operation_auto_fill.model_stock_picking +msgid "Transfer" +msgstr "Transferir" diff --git a/stock_move_line_auto_fill/i18n/stock_pack_operation_auto_fill.pot b/stock_move_line_auto_fill/i18n/stock_pack_operation_auto_fill.pot new file mode 100644 index 00000000000..d51c24b867b --- /dev/null +++ b/stock_move_line_auto_fill/i18n/stock_pack_operation_auto_fill.pot @@ -0,0 +1,62 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_pack_operation_auto_fill +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.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_pack_operation_auto_fill +#: model:ir.model.fields,field_description:stock_pack_operation_auto_fill.field_stock_picking_action_pack_op_auto_fill_allowed +msgid "Action Pack Op Auto Fill Allowed" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model.fields,field_description:stock_pack_operation_auto_fill.field_stock_picking_auto_fill_operation +#: model:ir.model.fields,field_description:stock_pack_operation_auto_fill.field_stock_picking_type_auto_fill_operation +msgid "Auto fill operations" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.ui.view,arch_db:stock_pack_operation_auto_fill.stock_picking_form_view +msgid "AutoFill" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model.fields,field_description:stock_pack_operation_auto_fill.field_stock_picking_type_avoid_lot_assignment +msgid "Avoid auto-assignment of lots" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: code:addons/stock_pack_operation_auto_fill/models/stock_picking.py:36 +#, python-format +msgid "Filling the operations automatically is not possible, perhaps the pickings aren't in the right state (Partially available or available)." +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model,name:stock_pack_operation_auto_fill.model_stock_move +msgid "Stock Move" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model,name:stock_pack_operation_auto_fill.model_stock_picking_type +msgid "The operation type determines the picking view" +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.ui.view,arch_db:stock_pack_operation_auto_fill.stock_picking_form_view +msgid "This button will automatically fill all operations that have no tracking set on the product, no processed qty and no selected package." +msgstr "" + +#. module: stock_pack_operation_auto_fill +#: model:ir.model,name:stock_pack_operation_auto_fill.model_stock_picking +msgid "Transfer" +msgstr "" + diff --git a/stock_move_line_auto_fill/migrations/11.0.2.0.0/post-migrate.py b/stock_move_line_auto_fill/migrations/11.0.2.0.0/post-migrate.py new file mode 100644 index 00000000000..bef7cf278aa --- /dev/null +++ b/stock_move_line_auto_fill/migrations/11.0.2.0.0/post-migrate.py @@ -0,0 +1,19 @@ +# Copyright 2018 Sergio Teruel +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + +from openupgradelib import openupgrade +from openupgradelib import openupgrade_tools + + +@openupgrade.migrate() +def migrate(env, version): + # If exists the column and is False so the user wants automatic assignment + if openupgrade_tools.column_exists( + env.cr, 'stock_picking_type', 'avoid_internal_assignment'): + openupgrade.logged_query( + env.cr, """ + UPDATE stock_picking_type + SET auto_fill_operation = True, + avoid_lot_assignment = False + WHERE NOT avoid_internal_assignment""" + ) diff --git a/stock_move_line_auto_fill/models/__init__.py b/stock_move_line_auto_fill/models/__init__.py new file mode 100644 index 00000000000..e0277fb6483 --- /dev/null +++ b/stock_move_line_auto_fill/models/__init__.py @@ -0,0 +1,5 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import stock_move +from . import stock_picking +from . import stock_picking_type diff --git a/stock_move_line_auto_fill/models/stock_move.py b/stock_move_line_auto_fill/models/stock_move.py new file mode 100644 index 00000000000..dc1b02aa7bc --- /dev/null +++ b/stock_move_line_auto_fill/models/stock_move.py @@ -0,0 +1,25 @@ +# Copyright 2017 Pedro M. Baeza +# Copyright 2018 David Vidal +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import models + + +class StockMove(models.Model): + _inherit = 'stock.move' + + def _prepare_move_line_vals(self, quantity=None, reserved_quant=None): + """Auto-assign as done the quantity proposed for the lots""" + self.ensure_one() + res = super(StockMove, self)._prepare_move_line_vals( + quantity, reserved_quant, + ) + if not self.picking_id.auto_fill_operation: + return res + elif (self.picking_id.picking_type_id.avoid_lot_assignment and + res.get('lot_id')): + return res + res.update({ + 'qty_done': res.get('product_uom_qty', 0.0), + }) + return res diff --git a/stock_move_line_auto_fill/models/stock_picking.py b/stock_move_line_auto_fill/models/stock_picking.py new file mode 100644 index 00000000000..c19536311b2 --- /dev/null +++ b/stock_move_line_auto_fill/models/stock_picking.py @@ -0,0 +1,56 @@ +# Copyright 2017 ACSONE SA/NV +# Copyright 2018 JARSA Sistemas S.A. de C.V. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import _, api, fields, models +from odoo.exceptions import UserError + + +class StockPicking(models.Model): + + _inherit = 'stock.picking' + + action_pack_op_auto_fill_allowed = fields.Boolean( + compute='_compute_action_pack_operation_auto_fill_allowed', + readonly=True, + ) + auto_fill_operation = fields.Boolean( + related='picking_type_id.auto_fill_operation', + string='Auto fill operations', + readonly=True, + ) + + @api.depends('state', 'move_line_ids') + def _compute_action_pack_operation_auto_fill_allowed(self): + """ The auto fill button is allowed only in ready state, and the + picking have pack operations. + """ + for rec in self: + rec.action_pack_op_auto_fill_allowed = ( + rec.state == 'assigned' and rec.move_line_ids) + + @api.multi + def _check_action_pack_operation_auto_fill_allowed(self): + if any(not r.action_pack_op_auto_fill_allowed for r in self): + raise UserError( + _("Filling the operations automatically is not possible, " + "perhaps the pickings aren't in the right state " + "(Partially available or available).")) + + @api.multi + def action_pack_operation_auto_fill(self): + """ Fill automatically pack operation for products with the following + conditions: + - the package is not required, the package is required if the + the no product is set on the operation. + - the operation has no qty_done yet. + """ + self._check_action_pack_operation_auto_fill_allowed() + operations = self.mapped('move_line_ids') + operations_to_auto_fill = operations.filtered(lambda op: ( + op.product_id and not op.qty_done and + (not op.lots_visible or + not op.picking_id.picking_type_id.avoid_lot_assignment) + )) + for op in operations_to_auto_fill: + op.qty_done = op.product_uom_qty diff --git a/stock_move_line_auto_fill/models/stock_picking_type.py b/stock_move_line_auto_fill/models/stock_picking_type.py new file mode 100644 index 00000000000..2e9fc4481ac --- /dev/null +++ b/stock_move_line_auto_fill/models/stock_picking_type.py @@ -0,0 +1,21 @@ +# Copyright 2017 Pedro M. Baeza +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class StockPickingType(models.Model): + _inherit = 'stock.picking.type' + + auto_fill_operation = fields.Boolean( + string="Auto fill operations", + help="To auto fill done quantity in picking document.\n" + "- If checked, auto fill done quantity automatically\n" + "- If unchecked, show button AutoFill" + " for user to do the auto fill manually", + ) + avoid_lot_assignment = fields.Boolean( + string="Avoid auto-assignment of lots", + help="Avoid auto fill for more line with lots product", + default=True, + ) diff --git a/stock_move_line_auto_fill/readme/CONFIGURE.rst b/stock_move_line_auto_fill/readme/CONFIGURE.rst new file mode 100644 index 00000000000..0781f37e7c4 --- /dev/null +++ b/stock_move_line_auto_fill/readme/CONFIGURE.rst @@ -0,0 +1,12 @@ +To configure this module, you need to: + +#. Make sure you have selected the proper removal strategy on your product + categories. +#. Configure the product on the page "Inventory", field "Tracking" with one of + these values: "By Unique Serial Number" or "By Lots" if you want autoassign + lots. +#. Check in Operation type if you want auto assign quantities, by default if + you want assign quantities done to reserved quantities you must push the + button "Auto Fill" when the picking is in ready state and has move lines +#. Check in Operation type if you do not want auto assign lots quantities with + "Avoid auto-assignment of lots". diff --git a/stock_move_line_auto_fill/readme/CONTRIBUTORS.rst b/stock_move_line_auto_fill/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000000..c9e0d186702 --- /dev/null +++ b/stock_move_line_auto_fill/readme/CONTRIBUTORS.rst @@ -0,0 +1,8 @@ +* Zakaria Makrelouf (ACSONE SA/NV) +* Luis Triana (Jarsa Sistemas de S.A. de C.V.) +* `Tecnativa `_: + * Pedro M. Baeza + * Vicent Cubells + * Sergio Teruel + * David Vidal +* Jaime Arroyo (Creu Blanca) diff --git a/stock_move_line_auto_fill/readme/DESCRIPTION.rst b/stock_move_line_auto_fill/readme/DESCRIPTION.rst new file mode 100644 index 00000000000..09b795f67f2 --- /dev/null +++ b/stock_move_line_auto_fill/readme/DESCRIPTION.rst @@ -0,0 +1,21 @@ +This module alows to auto fill quantities in picking operations and autoassignment +lots quantities. + +In Odoo, if you schedule to transfer 50 products and only receive 49, you have +to change the quantity directly on the picking. +As the quantity by default is 0 for each line, you have to write the received +quantity on 49 lines. + +In this module we have added a button that helps users to fill automatically +the scheduled quantities. Then, the user can just change back the quantities +for the product that hasn't been received yet. + +Products with lots +================== +When working with lots, it's very uncomfortable to introduce the quantity, +lot by lot, when transferring pickings from your warehouse (outgoing or +internal). + +This module automatically assigns the reserved quantity as the done one, so +that you only have to change it in case of divergence, but having the +possibility of transferring directly. diff --git a/stock_move_line_auto_fill/readme/USAGE.rst b/stock_move_line_auto_fill/readme/USAGE.rst new file mode 100644 index 00000000000..796cb757f59 --- /dev/null +++ b/stock_move_line_auto_fill/readme/USAGE.rst @@ -0,0 +1,20 @@ +Set options in operation types, you can set 'Auto fill operation' what make +autoassignment button invisible and fill the quantities in operations for lines +and 'Avoid Autoassignment Lots' what allow fill manually the lots quantities. + +Products without tracking lots +============================== +After confirming the picking, click on `Auto fill operations` button. The +Operations matching the following conditions will be filled automatically: + +* The operation has not be processed (i.e `qty_done == 0`). +* The operation has no package set (i.e `package_id` is empty). + +Product with lots +================= +#. Create an outgoing or an internal picking. +#. Include one product with lots and with enough stock. +#. Click on "Mark as Todo" button, and then on "Reserve". +#. Clicking on the icon with the three items bullet list on the "Operations" + tab you will see that the quantities have been auto-assigned on the "Done" + column. diff --git a/stock_move_line_auto_fill/static/description/icon.png b/stock_move_line_auto_fill/static/description/icon.png new file mode 100644 index 00000000000..1f1849da9ba Binary files /dev/null and b/stock_move_line_auto_fill/static/description/icon.png differ diff --git a/stock_move_line_auto_fill/static/description/index.html b/stock_move_line_auto_fill/static/description/index.html new file mode 100644 index 00000000000..730517eb549 --- /dev/null +++ b/stock_move_line_auto_fill/static/description/index.html @@ -0,0 +1,481 @@ + + + + + + +Stock Move Line Auto Fill + + + +
+

Stock Move Line Auto Fill

+ + +

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

+

This module alows to auto fill quantities in picking operations and autoassignment +lots quantities.

+

In Odoo, if you schedule to transfer 50 products and only receive 49, you have +to change the quantity directly on the picking. +As the quantity by default is 0 for each line, you have to write the received +quantity on 49 lines.

+

In this module we have added a button that helps users to fill automatically +the scheduled quantities. Then, the user can just change back the quantities +for the product that hasn’t been received yet.

+
+

Products with lots

+

When working with lots, it’s very uncomfortable to introduce the quantity, +lot by lot, when transferring pickings from your warehouse (outgoing or +internal).

+

This module automatically assigns the reserved quantity as the done one, so +that you only have to change it in case of divergence, but having the +possibility of transferring directly.

+

Table of contents

+
+
+

Configuration

+

To configure this module, you need to:

+
    +
  1. Make sure you have selected the proper removal strategy on your product +categories.
  2. +
  3. Configure the product on the page “Inventory”, field “Tracking” with one of +these values: “By Unique Serial Number” or “By Lots” if you want autoassign +lots.
  4. +
  5. Check in Operation type if you want auto assign quantities, by default if +you want assign quantities done to reserved quantities you must push the +button “Auto Fill” when the picking is in ready state and has move lines
  6. +
  7. Check in Operation type if you do not want auto assign lots quantities with +“Avoid auto-assignment of lots”.
  8. +
+
+
+

Usage

+

Set options in operation types, you can set ‘Auto fill operation’ what make +autoassignment button invisible and fill the quantities in operations for lines +and ‘Avoid Autoassignment Lots’ what allow fill manually the lots quantities.

+
+
+

Products without tracking lots

+

After confirming the picking, click on Auto fill operations button. The +Operations matching the following conditions will be filled automatically:

+
    +
  • The operation has not be processed (i.e qty_done == 0).
  • +
  • The operation has no package set (i.e package_id is empty).
  • +
+
+
+

Product with lots

+
    +
  1. Create an outgoing or an internal picking.
  2. +
  3. Include one product with lots and with enough stock.
  4. +
  5. Click on “Mark as Todo” button, and then on “Reserve”.
  6. +
  7. Clicking on the icon with the three items bullet list on the “Operations” +tab you will see that the quantities have been auto-assigned on the “Done” +column.
  8. +
+
+
+

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

+
    +
  • ACSONE SA/NV
  • +
  • Tecnativa
  • +
+
+
+

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-workflow project on GitHub.

+

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

+
+
+
+ + diff --git a/stock_move_line_auto_fill/tests/__init__.py b/stock_move_line_auto_fill/tests/__init__.py new file mode 100644 index 00000000000..51bcbc7d9fa --- /dev/null +++ b/stock_move_line_auto_fill/tests/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import test_stock_picking_auto_fill diff --git a/stock_move_line_auto_fill/tests/test_stock_picking_auto_fill.py b/stock_move_line_auto_fill/tests/test_stock_picking_auto_fill.py new file mode 100644 index 00000000000..6902ed9030d --- /dev/null +++ b/stock_move_line_auto_fill/tests/test_stock_picking_auto_fill.py @@ -0,0 +1,324 @@ +# Copyright 2017 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.tests.common import TransactionCase +from odoo.exceptions import UserError + + +class TestStockPicking(TransactionCase): + + def setUp(self): + super(TestStockPicking, self).setUp() + + # models + self.picking_model = self.env['stock.picking'] + self.move_model = self.env['stock.move'] + + # warehouse and picking types + self.warehouse = self.env.ref('stock.stock_warehouse_shop0') + self.picking_type_in = self.env.ref('stock.chi_picking_type_in') + self.picking_type_out = self.env.ref('stock.chi_picking_type_out') + self.supplier_location = self.env.ref('stock.stock_location_suppliers') + self.customer_location = self.env.ref('stock.stock_location_customers') + + # products + self.product_8 = self.env.ref('product.product_product_8') + self.product_9 = self.env.ref('product.product_product_9') + self.product_10 = self.env.ref('product.product_product_10') + self.product_11 = self.env.ref('product.product_product_11') + self.product_12 = self.env.ref('product.product_product_12') + + # supplier + self.supplier = self.env.ref('base.res_partner_1') + # customer + self.customer = self.env.ref('base.res_partner_12') + + self.picking = self.picking_model.with_context( + default_picking_type_id=self.picking_type_in.id).create({ + 'partner_id': self.supplier.id, + 'picking_type_id': self.picking_type_in.id, + 'location_id': self.supplier_location.id}) + self.picking_out = self.picking_model.with_context( + default_picking_type_id=self.picking_type_out.id + ).create({ + 'partner_id': self.customer.id, + 'picking_type_id': self.picking_type_out.id, + 'location_id': self.picking_type_out.default_location_src_id.id, + 'location_dest_id': self.customer_location.id, + }) + self.dozen = self.env.ref('uom.product_uom_dozen') + + def test_compute_action_pack_operation_auto_fill_allowed(self): + + self.move_model.create( + dict(product_id=self.product_9.id, + picking_id=self.picking.id, + name=self.product_9.display_name, + picking_type_id=self.picking_type_in.id, + product_uom_qty=1.0, + location_id=self.supplier_location.id, + location_dest_id=self.picking_type_in. + default_location_dest_id.id, + product_uom=self.product_9.uom_id.id)) + + # the auto fill action isn't available when picking is in draft + # state. + self.assertEqual(self.picking.state, 'draft') + self.assertFalse(self.picking.action_pack_op_auto_fill_allowed) + + # the auto fill action isn't available if no pack operation is + # created. + self.picking.state = 'assigned' + self.assertFalse(self.picking.action_pack_op_auto_fill_allowed) + + # The auto fill action is available when picking is assigned and + # the picking have already pack operations. + self.picking.action_confirm() + self.assertTrue(self.picking.action_pack_op_auto_fill_allowed) + + def test_check_action_pack_operation_auto_fill_allowed(self): + + self.move_model.create( + dict(product_id=self.product_9.id, + picking_id=self.picking.id, + name=self.product_9.display_name, + picking_type_id=self.picking_type_in.id, + product_uom_qty=1.0, + location_id=self.supplier_location.id, + location_dest_id=self.picking_type_in. + default_location_dest_id.id, + product_uom=self.product_9.uom_id.id)) + + # the auto fill action isn't available when picking is in draft + # state. + self.assertEqual(self.picking.state, 'draft') + with self.cr.savepoint(), self.assertRaises(UserError): + self.picking.action_pack_operation_auto_fill() + + # the auto fill action isn't available if no pack operation is + # created. + self.picking.state = 'assigned' + with self.cr.savepoint(), self.assertRaises(UserError): + self.picking.action_pack_operation_auto_fill() + + # The auto fill action is available when picking is assigned and + # the picking have already pack operations. + self.picking.action_confirm() + self.picking.action_pack_operation_auto_fill() + + def test_action_pack_operation_auto_fill(self): + + # set tracking on the products + self.picking_type_in.use_create_lots = True + self.product_8.tracking = 'lot' + self.product_9.tracking = 'none' + self.product_10.tracking = 'serial' + self.product_11.tracking = 'none' + + self.move_model.create( + dict(product_id=self.product_8.id, + picking_id=self.picking.id, + name=self.product_8.display_name, + picking_type_id=self.picking_type_in.id, + product_uom_qty=1.0, + location_id=self.supplier_location.id, + location_dest_id=self.picking_type_in. + default_location_dest_id.id, + product_uom=self.product_8.uom_id.id)) + + self.move_model.create( + dict(product_id=self.product_9.id, + picking_id=self.picking.id, + name=self.product_9.display_name, + picking_type_id=self.picking_type_in.id, + product_uom_qty=1.0, + location_id=self.supplier_location.id, + location_dest_id=self.picking_type_in. + default_location_dest_id.id, + product_uom=self.product_9.uom_id.id)) + + self.move_model.create( + dict(product_id=self.product_10.id, + picking_id=self.picking.id, + name=self.product_10.display_name, + picking_type_id=self.picking_type_in.id, + product_uom_qty=1.0, + location_id=self.supplier_location.id, + location_dest_id=self.picking_type_in. + default_location_dest_id.id, + product_uom=self.product_10.uom_id.id)) + + self.move_model.create( + dict(product_id=self.product_11.id, + picking_id=self.picking.id, + name=self.product_11.display_name + ' pack', + picking_type_id=self.picking_type_in.id, + product_uom_qty=1.0, + location_id=self.supplier_location.id, + location_dest_id=self.picking_type_in. + default_location_dest_id.id, + product_uom=self.product_11.uom_id.id)) + + self.move_model.create( + dict(product_id=self.product_12.id, + picking_id=self.picking.id, + name=self.product_12.display_name, + picking_type_id=self.picking_type_in.id, + product_uom_qty=1.0, + location_id=self.supplier_location.id, + location_dest_id=self.picking_type_in. + default_location_dest_id.id, + product_uom=self.dozen.id)) + + self.picking.action_confirm() + self.assertEqual(self.picking.state, 'assigned') + self.assertEqual(len(self.picking.move_line_ids), 5) + + # At this point for each move we have an operation created. + product_8_op = self.picking.move_line_ids.filtered( + lambda p: p.product_id == self.product_8) + self.assertTrue(product_8_op) + + product_9_op = self.picking.move_line_ids.filtered( + lambda p: p.product_id == self.product_9) + self.assertTrue(product_9_op) + + product_11_op = self.picking.move_line_ids.filtered( + lambda p: p.product_id == self.product_11) + self.assertTrue(product_11_op) + + product_12_op = self.picking.move_line_ids.filtered( + lambda p: p.product_id == self.product_12) + + # replace the product_id with a pack in for the product_11_op + # operation + pack = self.env['stock.quant.package'].create({ + 'quant_ids': [(0, 0, { + 'product_id': self.product_11.id, + 'quantity': 1, + 'location_id': self.supplier_location.id, + 'product_uom_id': self.product_11.uom_id.id})]}) + + product_11_op.write( + {'package_id': pack.id}) + + product_10_op = self.picking.move_line_ids.filtered( + lambda p: p.product_id == self.product_10) + self.assertTrue(product_10_op) + + # Try to fill all the operation automatically. + # The expected result is only operations with product_id set and + # the product_id.tracking == none, have a qty_done set. + self.picking.action_pack_operation_auto_fill() + self.assertFalse(product_8_op.qty_done) + self.assertEqual(product_9_op.product_uom_qty, product_9_op.qty_done) + self.assertFalse(product_10_op.qty_done) + self.assertEqual(product_11_op.product_uom_qty, product_11_op.qty_done) + self.assertEqual(product_12_op.product_uom_qty, product_12_op.qty_done) + + def test_action_auto_transfer(self): + # set tracking on the products + self.picking_type_in.auto_fill_operation = True + self.product_8.tracking = 'lot' + self.product_9.tracking = 'none' + + self.move_model.create( + dict(product_id=self.product_8.id, + picking_id=self.picking.id, + name=self.product_8.display_name, + picking_type_id=self.picking_type_in.id, + product_uom_qty=1.0, + location_id=self.supplier_location.id, + location_dest_id=self.picking_type_in. + default_location_dest_id.id, + product_uom=self.product_8.uom_id.id)) + + self.move_model.create( + dict(product_id=self.product_9.id, + picking_id=self.picking.id, + name=self.product_9.display_name, + picking_type_id=self.picking_type_in.id, + product_uom_qty=1.0, + location_id=self.supplier_location.id, + location_dest_id=self.picking_type_in. + default_location_dest_id.id, + product_uom=self.product_9.uom_id.id)) + + self.picking.action_assign() + + self.assertEqual(self.picking.state, 'assigned') + self.assertEqual(len(self.picking.move_line_ids), 2) + + # At this point for each move we have an operation created. + product_8_op = self.picking.move_line_ids.filtered( + lambda p: p.product_id == self.product_8) + self.assertTrue(product_8_op) + + product_9_op = self.picking.move_line_ids.filtered( + lambda p: p.product_id == self.product_9) + self.assertTrue(product_9_op) + + # Try to fill all the operation automatically. + # The expected result is only opertions with product_id set and + self.assertTrue(product_8_op.qty_done) + self.assertTrue(product_9_op.qty_done) + + def test_action_auto_transfer_avoid_assign_lots(self): + # set tracking on the products + self.picking_type_out.auto_fill_operation = True + self.picking_type_out.avoid_lot_assignment = True + self.product_8.tracking = 'lot' + self.product_9.tracking = 'none' + self.lot8 = self.env['stock.production.lot'].create({ + 'product_id': self.product_8.id, + 'name': 'Lot 1', + }) + self.quant8 = self.env['stock.quant'].create({ + 'product_id': self.product_8.id, + 'location_id': self.picking_out.location_id.id, + 'quantity': 6, + 'lot_id': self.lot8.id, + }) + self.quant9 = self.env['stock.quant'].create({ + 'product_id': self.product_9.id, + 'location_id': self.picking_out.location_id.id, + 'quantity': 10, + }) + self.move_model.create({ + 'product_id': self.product_8.id, + 'picking_id': self.picking_out.id, + 'name': self.product_8.display_name, + 'picking_type_id': self.picking_type_out.id, + 'product_uom_qty': 1.0, + 'location_id': self.picking_type_out.default_location_src_id.id, + 'location_dest_id': self.customer_location.id, + 'product_uom': self.product_8.uom_id.id, + }) + + self.move_model.create({ + 'product_id': self.product_9.id, + 'picking_id': self.picking_out.id, + 'name': self.product_9.display_name, + 'picking_type_id': self.picking_type_out.id, + 'product_uom_qty': 10.0, + 'location_id': self.picking_type_out.default_location_src_id.id, + 'location_dest_id': self.customer_location.id, + 'product_uom': self.product_9.uom_id.id, + }) + + self.picking_out.action_confirm() + self.picking_out.action_assign() + self.assertEqual(self.picking_out.state, 'assigned') + self.assertEqual(len(self.picking_out.move_line_ids), 2) + # At this point for each move we have an operation created. + product_8_op = self.picking_out.move_line_ids.filtered( + lambda p: p.product_id == self.product_8) + self.assertTrue(product_8_op) + product_9_op = self.picking_out.move_line_ids.filtered( + lambda p: p.product_id == self.product_9) + self.assertTrue(product_9_op) + + # Try to fill all the operation automatically. + # The expected result is only opertions with product_id set and + self.assertFalse(product_8_op.qty_done) + self.assertTrue(product_9_op.qty_done) diff --git a/stock_move_line_auto_fill/views/stock_picking.xml b/stock_move_line_auto_fill/views/stock_picking.xml new file mode 100644 index 00000000000..17870a4e9dc --- /dev/null +++ b/stock_move_line_auto_fill/views/stock_picking.xml @@ -0,0 +1,21 @@ + + + + stock.picking.form (in stock_pack_operation_auto_fill) + stock.picking + + + + + + + diff --git a/stock_move_line_auto_fill/views/stock_picking_type_views.xml b/stock_move_line_auto_fill/views/stock_picking_type_views.xml new file mode 100644 index 00000000000..5d7f3cd6ae6 --- /dev/null +++ b/stock_move_line_auto_fill/views/stock_picking_type_views.xml @@ -0,0 +1,18 @@ + + + + + stock.picking.type.assignment + stock.picking.type + + + + + + + + + + + +