diff --git a/setup/stock_picking_package_grouped/odoo/addons/stock_picking_package_grouped b/setup/stock_picking_package_grouped/odoo/addons/stock_picking_package_grouped new file mode 120000 index 000000000..dfa6d9480 --- /dev/null +++ b/setup/stock_picking_package_grouped/odoo/addons/stock_picking_package_grouped @@ -0,0 +1 @@ +../../../../stock_picking_package_grouped \ No newline at end of file diff --git a/setup/stock_picking_package_grouped/setup.py b/setup/stock_picking_package_grouped/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/stock_picking_package_grouped/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/stock_picking_package_grouped/README.rst b/stock_picking_package_grouped/README.rst new file mode 100644 index 000000000..67a355b2a --- /dev/null +++ b/stock_picking_package_grouped/README.rst @@ -0,0 +1,93 @@ +============================ +Stock Picking Package Groups +============================ + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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_picking_package_grouped + :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_picking_package_grouped + :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 allows to create a package from picking for every detailed operation. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +To configure this module, you need to: + +#. Go to *Inventory > Configuration > Picking Type* +#. Select package grouping criteria + +Usage +===== + +To use this module, you need to: + +#. Go to *Inventory > Transfer* +#. Create a picking +#. Click on put in pack button. + +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 +~~~~~~~ + +* Tecnativa + +Contributors +~~~~~~~~~~~~ + +* `Tecnativa `_: + + * Carlos Dauden + * Sergio Teruel + +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_picking_package_grouped/__init__.py b/stock_picking_package_grouped/__init__.py new file mode 100644 index 000000000..31660d6a9 --- /dev/null +++ b/stock_picking_package_grouped/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import models diff --git a/stock_picking_package_grouped/__manifest__.py b/stock_picking_package_grouped/__manifest__.py new file mode 100644 index 000000000..13cfb1eb8 --- /dev/null +++ b/stock_picking_package_grouped/__manifest__.py @@ -0,0 +1,15 @@ +# Copyright 2021 Tecnativa - Sergio Teruel +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Stock Picking Package Groups", + "summary": "Allow create package (put in pack) from pickings " + "depending on grouping criteria.", + "version": "13.0.1.0.0", + "category": "Stock", + "website": "https://github.com/OCA/stock-logistics-warehouse", + "author": "Tecnativa, Odoo Community Association (OCA)", + "license": "AGPL-3", + "installable": True, + "depends": ["stock"], + "data": ["views/stock_picking_type_views.xml"], +} diff --git a/stock_picking_package_grouped/i18n/es.po b/stock_picking_package_grouped/i18n/es.po new file mode 100644 index 000000000..4bc3bda4e --- /dev/null +++ b/stock_picking_package_grouped/i18n/es.po @@ -0,0 +1,59 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_picking_package_grouped +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-10-28 18:51+0000\n" +"PO-Revision-Date: 2021-10-28 20:57+0200\n" +"Last-Translator: Sergio Teruel \n" +"Language-Team: \n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 2.3\n" + +#. module: stock_picking_package_grouped +#: model:ir.model.fields.selection,name:stock_picking_package_grouped.selection__stock_picking_type__package_grouping__line +msgid "No line grouping" +msgstr "Sin agrupación por línea" + +#. module: stock_picking_package_grouped +#: model:ir.model.fields,field_description:stock_picking_package_grouped.field_stock_picking_type__package_grouping +msgid "Package grouping" +msgstr "Agrupación de paquetes" + +#. module: stock_picking_package_grouped +#: model:ir.model,name:stock_picking_package_grouped.model_stock_picking_type +msgid "Picking Type" +msgstr "Tipo de albarán" + +#. module: stock_picking_package_grouped +#: model:ir.model.fields,help:stock_picking_package_grouped.field_stock_picking_type__package_grouping +msgid "" +"Select the behaviour for grouping detailed operations in packages:\n" +"* Standard grouping (default): All detailed operation will generate one " +"package always.\n" +"* No line grouping: Every detailed operation will generate one package.\n" +"* : If no value is selected, system-wide default will be used." +msgstr "" +"Selecciona el comportamiento para agrupar operaciones detalladas en " +"paquetes:\n" +"* Agrupación standard (default): Todas las operaciones detalladas generarán " +"siempre un paquete.\n" +"* Sin agrupación por línea: Cada operación detallada generará un paquete.\n" +"* Vacío: Si no hay valor seleccionado, se usará el comportamiento estandard." + +#. module: stock_picking_package_grouped +#: model:ir.model.fields.selection,name:stock_picking_package_grouped.selection__stock_picking_type__package_grouping__standard +msgid "Standard grouping" +msgstr "Agrupación estándar" + +#. module: stock_picking_package_grouped +#: model:ir.model,name:stock_picking_package_grouped.model_stock_picking +msgid "Transfer" +msgstr "Albarán" diff --git a/stock_picking_package_grouped/i18n/stock_picking_package_grouped.pot b/stock_picking_package_grouped/i18n/stock_picking_package_grouped.pot new file mode 100644 index 000000000..9e1b21731 --- /dev/null +++ b/stock_picking_package_grouped/i18n/stock_picking_package_grouped.pot @@ -0,0 +1,50 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_picking_package_grouped +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-10-28 18:51+0000\n" +"PO-Revision-Date: 2021-10-28 18:51+0000\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_picking_package_grouped +#: model:ir.model.fields.selection,name:stock_picking_package_grouped.selection__stock_picking_type__package_grouping__line +msgid "No line grouping" +msgstr "" + +#. module: stock_picking_package_grouped +#: model:ir.model.fields,field_description:stock_picking_package_grouped.field_stock_picking_type__package_grouping +msgid "Package grouping" +msgstr "" + +#. module: stock_picking_package_grouped +#: model:ir.model,name:stock_picking_package_grouped.model_stock_picking_type +msgid "Picking Type" +msgstr "" + +#. module: stock_picking_package_grouped +#: model:ir.model.fields,help:stock_picking_package_grouped.field_stock_picking_type__package_grouping +msgid "" +"Select the behaviour for grouping detailed operations in packages:\n" +"* Standard grouping (default): All detailed operation will generate one package always.\n" +"* No line grouping: Every detailed operation will generate one package.\n" +"* : If no value is selected, system-wide default will be used." +msgstr "" + +#. module: stock_picking_package_grouped +#: model:ir.model.fields.selection,name:stock_picking_package_grouped.selection__stock_picking_type__package_grouping__standard +msgid "Standard grouping" +msgstr "" + +#. module: stock_picking_package_grouped +#: model:ir.model,name:stock_picking_package_grouped.model_stock_picking +msgid "Transfer" +msgstr "" diff --git a/stock_picking_package_grouped/models/__init__.py b/stock_picking_package_grouped/models/__init__.py new file mode 100644 index 000000000..18902bfcb --- /dev/null +++ b/stock_picking_package_grouped/models/__init__.py @@ -0,0 +1,5 @@ +# Copyright 2020 Tecnativa - Sergio Teruel +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import stock_picking +from . import stock_picking_type diff --git a/stock_picking_package_grouped/models/stock_picking.py b/stock_picking_package_grouped/models/stock_picking.py new file mode 100644 index 000000000..d236b8516 --- /dev/null +++ b/stock_picking_package_grouped/models/stock_picking.py @@ -0,0 +1,18 @@ +# Copyright 2021 Sergio Teruel - Tecnativa +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +from odoo import models + + +class StockPicking(models.Model): + _inherit = "stock.picking" + + def _put_in_pack(self, move_line_ids): + package = False + for picking in self: + if picking.picking_type_id.package_grouping == "line": + for move_line in move_line_ids: + package = super(StockPicking, picking)._put_in_pack(move_line) + else: + package = super(StockPicking, picking)._put_in_pack(move_line_ids) + return package diff --git a/stock_picking_package_grouped/models/stock_picking_type.py b/stock_picking_package_grouped/models/stock_picking_type.py new file mode 100644 index 000000000..7ef148d3d --- /dev/null +++ b/stock_picking_package_grouped/models/stock_picking_type.py @@ -0,0 +1,19 @@ +# Copyright 2021 Sergio Teruel - Tecnativa +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +from odoo import fields, models + + +class PickingType(models.Model): + _inherit = "stock.picking.type" + + package_grouping = fields.Selection( + [("standard", "Standard grouping"), ("line", "No line grouping")], + string="Package grouping", + default="standard", + help="Select the behaviour for grouping detailed operations in packages:\n" + "* Standard grouping (default): All detailed operation will generate " + "one package always.\n" + "* No line grouping: Every detailed operation will generate one package." + "* : If no value is selected, system-wide default will be used.\n", + ) diff --git a/stock_picking_package_grouped/readme/CONFIGURE.rst b/stock_picking_package_grouped/readme/CONFIGURE.rst new file mode 100644 index 000000000..6a26e27f0 --- /dev/null +++ b/stock_picking_package_grouped/readme/CONFIGURE.rst @@ -0,0 +1,4 @@ +To configure this module, you need to: + +#. Go to *Inventory > Configuration > Picking Type* +#. Select package grouping criteria diff --git a/stock_picking_package_grouped/readme/CONTRIBUTORS.rst b/stock_picking_package_grouped/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..66d11c825 --- /dev/null +++ b/stock_picking_package_grouped/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* `Tecnativa `_: + + * Carlos Dauden + * Sergio Teruel diff --git a/stock_picking_package_grouped/readme/DESCRIPTION.rst b/stock_picking_package_grouped/readme/DESCRIPTION.rst new file mode 100644 index 000000000..4993c2c2c --- /dev/null +++ b/stock_picking_package_grouped/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +This module allows to create a package from picking for every detailed operation. diff --git a/stock_picking_package_grouped/readme/USAGE.rst b/stock_picking_package_grouped/readme/USAGE.rst new file mode 100644 index 000000000..105097926 --- /dev/null +++ b/stock_picking_package_grouped/readme/USAGE.rst @@ -0,0 +1,5 @@ +To use this module, you need to: + +#. Go to *Inventory > Transfer* +#. Create a picking +#. Click on put in pack button. diff --git a/stock_picking_package_grouped/static/description/icon.png b/stock_picking_package_grouped/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/stock_picking_package_grouped/static/description/icon.png differ diff --git a/stock_picking_package_grouped/static/description/index.html b/stock_picking_package_grouped/static/description/index.html new file mode 100644 index 000000000..5e99e6562 --- /dev/null +++ b/stock_picking_package_grouped/static/description/index.html @@ -0,0 +1,445 @@ + + + + + + +Stock Picking Package Groups + + + +
+

Stock Picking Package Groups

+ + +

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

+

This module allows to create a package from picking for every detailed operation.

+

Table of contents

+ +
+

Configuration

+

To configure this module, you need to:

+
    +
  1. Go to Inventory > Configuration > Picking Type
  2. +
  3. Select package grouping criteria
  4. +
+
+
+

Usage

+

To use this module, you need to:

+
    +
  1. Go to Inventory > Transfer
  2. +
  3. Create a picking
  4. +
  5. Click on put in pack button.
  6. +
+
+
+

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

+
    +
  • Tecnativa
  • +
+
+
+

Contributors

+
    +
  • Tecnativa:

    +
    +
      +
    • Carlos Dauden
    • +
    • Sergio Teruel
    • +
    +
    +
  • +
+
+
+

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_picking_package_grouped/tests/__init__.py b/stock_picking_package_grouped/tests/__init__.py new file mode 100644 index 000000000..6118cda63 --- /dev/null +++ b/stock_picking_package_grouped/tests/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import test_stock_picking_package_grouped diff --git a/stock_picking_package_grouped/tests/test_stock_picking_package_grouped.py b/stock_picking_package_grouped/tests/test_stock_picking_package_grouped.py new file mode 100644 index 000000000..36d830478 --- /dev/null +++ b/stock_picking_package_grouped/tests/test_stock_picking_package_grouped.py @@ -0,0 +1,79 @@ +# Copyright 2021 Tecnativa - Sergio Teruel +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo.tests import Form +from odoo.tests.common import TransactionCase + + +class TestStockPicking(TransactionCase): + def setUp(self): + super(TestStockPicking, self).setUp() + + # models + self.picking_model = self.env["stock.picking"] + + # warehouse and picking types + self.warehouse = self.env.ref("stock.stock_warehouse_shop0") + 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") + + # Allow all companies for OdooBot user and set default user company + # to warehouse company + companies = self.env["res.company"].search([]) + self.env.user.company_ids = [(6, 0, companies.ids)] + self.env.user.company_id = self.warehouse.company_id + + # 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") + product_list = [self.product_8, self.product_9, self.product_10] + + # customer + self.customer = self.env.ref("base.res_partner_12") + + picking_form = Form( + self.picking_model.with_context( + default_picking_type_id=self.picking_type_out.id + ) + ) + picking_form.partner_id = self.customer + picking_form.picking_type_id = self.picking_type_out + picking_form.location_id = self.picking_type_out.default_location_src_id + picking_form.location_dest_id = self.customer_location + for product in product_list: + with picking_form.move_ids_without_package.new() as line_form: + line_form.product_id = product + line_form.product_uom_qty = 1 + self.picking_out = picking_form.save() + + def test_no_value_selected(self): + self.picking_out.action_assign() + # Add done quantities + for line in self.picking_out.move_lines: + line.quantity_done = line.product_uom_qty + self.picking_out.picking_type_id.package_grouping = False + self.picking_out.put_in_pack() + packages = self.picking_out.mapped("move_line_ids.result_package_id") + self.assertEqual(len(packages), 1) + + def test_one_package_per_detailed_operation_line(self): + self.picking_out.action_assign() + # Add done quantities + for line in self.picking_out.move_lines: + line.quantity_done = line.product_uom_qty + self.picking_out.picking_type_id.package_grouping = "line" + self.picking_out.put_in_pack() + packages = self.picking_out.mapped("move_line_ids.result_package_id") + self.assertEqual(len(packages), 3) + + def test_one_package_per_all_detailed_operation_line(self): + self.picking_out.action_assign() + # Add done quantities + for line in self.picking_out.move_lines: + line.quantity_done = line.product_uom_qty + self.picking_out.picking_type_id.package_grouping = "standard" + self.picking_out.put_in_pack() + packages = self.picking_out.mapped("move_line_ids.result_package_id") + self.assertEqual(len(packages), 1) diff --git a/stock_picking_package_grouped/views/stock_picking_type_views.xml b/stock_picking_package_grouped/views/stock_picking_type_views.xml new file mode 100644 index 000000000..539bbfe95 --- /dev/null +++ b/stock_picking_package_grouped/views/stock_picking_type_views.xml @@ -0,0 +1,12 @@ + + + + stock.picking.type + + + + + + + +