diff --git a/stock_move_packaging_qty/README.rst b/stock_move_packaging_qty/README.rst index a1d69adb8064..5ef641a4ec17 100644 --- a/stock_move_packaging_qty/README.rst +++ b/stock_move_packaging_qty/README.rst @@ -1,7 +1,3 @@ -.. image:: https://odoo-community.org/readme-banner-image - :target: https://odoo-community.org/get-involved?utm_source=readme - :alt: Odoo Community Association - =================== Stock Packaging Qty =================== @@ -17,7 +13,7 @@ Stock Packaging Qty .. |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/license-LGPL--3-blue.png +.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html :alt: License: LGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github diff --git a/stock_move_packaging_qty/__manifest__.py b/stock_move_packaging_qty/__manifest__.py index aa9cfd0093d0..89e986230106 100644 --- a/stock_move_packaging_qty/__manifest__.py +++ b/stock_move_packaging_qty/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Stock Packaging Qty", "summary": "Add packaging fields in the stock moves", - "version": "18.0.1.1.1", + "version": "18.0.1.2.0", "author": "ForgeFlow, Moduon, Odoo Community Association (OCA)", "website": "https://github.com/OCA/stock-logistics-warehouse", "category": "Warehouse", @@ -13,6 +13,7 @@ "views/stock_move_line_view.xml", "views/stock_move_view.xml", "views/stock_picking_view.xml", + "views/stock_picking_type_view.xml", ], "pre_init_hook": "pre_init_hook", "license": "LGPL-3", diff --git a/stock_move_packaging_qty/i18n/es.po b/stock_move_packaging_qty/i18n/es.po index efc8c78730f8..91cd032bbca6 100644 --- a/stock_move_packaging_qty/i18n/es.po +++ b/stock_move_packaging_qty/i18n/es.po @@ -4,18 +4,18 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 18.0+e\n" +"Project-Id-Version: Odoo Server 18.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-04-17 07:22+0000\n" -"PO-Revision-Date: 2026-04-17 07:22+0000\n" -"Last-Translator: David Vidal \n" -"Language-Team: none\n" +"POT-Creation-Date: 2026-04-29 09:10+0000\n" +"PO-Revision-Date: 2026-04-29 11:12+0200\n" +"Last-Translator: \n" +"Language-Team: \n" "Language: es\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 5.15.2\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 3.6\n" #. module: stock_move_packaging_qty #: model_terms:ir.ui.view,arch_db:stock_move_packaging_qty.view_stock_move_operations @@ -27,6 +27,11 @@ msgstr "(" msgid ")" msgstr ")" +#. module: stock_move_packaging_qty +#: model:ir.model.fields,field_description:stock_move_packaging_qty.field_stock_picking_type__automatic_done_packaging_calculation +msgid "Automatically Calculate Done Packaging Quantity" +msgstr "Calcular Automáticamente Envases Hechos" + #. module: stock_move_packaging_qty #: model:ir.model.fields,field_description:stock_move_packaging_qty.field_stock_move__product_packaging_quantity #: model:ir.model.fields,field_description:stock_move_packaging_qty.field_stock_move_line__product_packaging_quantity @@ -50,12 +55,17 @@ msgstr "Env. hechos" #: model_terms:ir.ui.view,arch_db:stock_move_packaging_qty.view_stock_move_line_detailed_operation_tree #: model_terms:ir.ui.view,arch_db:stock_move_packaging_qty.view_stock_move_line_operation_tree msgid "Packaging" -msgstr "Envase" +msgstr "Embalaje" + +#. module: stock_move_packaging_qty +#: model:ir.model,name:stock_move_packaging_qty.model_stock_picking_type +msgid "Picking Type" +msgstr "Tipo de albarán" #. module: stock_move_packaging_qty #: model:ir.model,name:stock_move_packaging_qty.model_stock_move_line msgid "Product Moves (Stock Move Line)" -msgstr "Movimientos de existencias" +msgstr "Movimientos de producto (línea de movimiento de stock)" #. module: stock_move_packaging_qty #: model:ir.model.fields,help:stock_move_packaging_qty.field_stock_move_line__product_packaging_quantity @@ -76,7 +86,17 @@ msgstr "Envs. reservados" #. module: stock_move_packaging_qty #: model:ir.model,name:stock_move_packaging_qty.model_stock_move msgid "Stock Move" -msgstr "Movimiento de existencias" +msgstr "Movimiento de stock" + +#. module: stock_move_packaging_qty +#: model:ir.model.fields,help:stock_move_packaging_qty.field_stock_picking_type__automatic_done_packaging_calculation +msgid "" +"The system calculates Done Packaging Automatically on Stock Move Lines.\n" +"Disable this to prevent automatic calculation." +msgstr "" +"El sistema calcula la Cantidad de Envases Hechos en las Línea de " +"movimientos de stock.\n" +"Desactiva esta opción para prevenir el cálculo automático." #. module: stock_move_packaging_qty #. odoo-python diff --git a/stock_move_packaging_qty/i18n/stock_move_packaging_qty.pot b/stock_move_packaging_qty/i18n/stock_move_packaging_qty.pot index 4b4a10606efd..311d65d03ee2 100644 --- a/stock_move_packaging_qty/i18n/stock_move_packaging_qty.pot +++ b/stock_move_packaging_qty/i18n/stock_move_packaging_qty.pot @@ -6,6 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 18.0\n" "Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2026-04-29 09:09+0000\n" +"PO-Revision-Date: 2026-04-29 09:09+0000\n" "Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -23,6 +25,11 @@ msgstr "" msgid ")" msgstr "" +#. module: stock_move_packaging_qty +#: model:ir.model.fields,field_description:stock_move_packaging_qty.field_stock_picking_type__automatic_done_packaging_calculation +msgid "Automatically Calculate Done Packaging Quantity" +msgstr "" + #. module: stock_move_packaging_qty #: model:ir.model.fields,field_description:stock_move_packaging_qty.field_stock_move__product_packaging_quantity #: model:ir.model.fields,field_description:stock_move_packaging_qty.field_stock_move_line__product_packaging_quantity @@ -48,6 +55,11 @@ msgstr "" msgid "Packaging" msgstr "" +#. module: stock_move_packaging_qty +#: model:ir.model,name:stock_move_packaging_qty.model_stock_picking_type +msgid "Picking Type" +msgstr "" + #. module: stock_move_packaging_qty #: model:ir.model,name:stock_move_packaging_qty.model_stock_move_line msgid "Product Moves (Stock Move Line)" @@ -74,6 +86,13 @@ msgstr "" msgid "Stock Move" msgstr "" +#. module: stock_move_packaging_qty +#: model:ir.model.fields,help:stock_move_packaging_qty.field_stock_picking_type__automatic_done_packaging_calculation +msgid "" +"The system calculates Done Packaging Automatically on Stock Move Lines.\n" +"Disable this to prevent automatic calculation." +msgstr "" + #. module: stock_move_packaging_qty #. odoo-python #: code:addons/stock_move_packaging_qty/models/stock_move.py:0 diff --git a/stock_move_packaging_qty/migrations/18.0.1.2.0/post-migrate.py b/stock_move_packaging_qty/migrations/18.0.1.2.0/post-migrate.py new file mode 100644 index 000000000000..1f6e263d9cfc --- /dev/null +++ b/stock_move_packaging_qty/migrations/18.0.1.2.0/post-migrate.py @@ -0,0 +1,21 @@ +# Copyright 2026 Moduon Team S.L. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +from odoo.tools import sql + + +def migrate(cr, version): + """Activate Picking Type Automatic Done Packaging Calculation.""" + if not sql.column_exists( + cr, "stock_picking_type", "automatic_done_packaging_calculation" + ): + sql.create_column( + cr, + "stock_picking_type", + "automatic_done_packaging_calculation", + "boolean", + comment="Automatically Calculate Done Packaging Quantity", + ) + cr.execute( + "UPDATE stock_picking_type SET automatic_done_packaging_calculation = True" + ) diff --git a/stock_move_packaging_qty/models/__init__.py b/stock_move_packaging_qty/models/__init__.py index f800274cd973..767fc2764bf5 100644 --- a/stock_move_packaging_qty/models/__init__.py +++ b/stock_move_packaging_qty/models/__init__.py @@ -1,2 +1,3 @@ from . import stock_move +from . import stock_picking_type from . import stock_move_line diff --git a/stock_move_packaging_qty/models/stock_move_line.py b/stock_move_packaging_qty/models/stock_move_line.py index 7ae56003ec4e..8b9fa99e67d7 100644 --- a/stock_move_packaging_qty/models/stock_move_line.py +++ b/stock_move_packaging_qty/models/stock_move_line.py @@ -18,11 +18,18 @@ class StockMoveLine(models.Model): help="Quantity done in Product Packaging", ) - @api.depends("move_id.product_packaging_id", "product_uom_id", "quantity") + @api.depends( + "picking_type_id", "move_id.product_packaging_id", "product_uom_id", "quantity" + ) def _compute_product_packaging_quantity(self): """Set product_packaging_quantity automatically.""" - self.product_packaging_quantity = 0 - for line in self: + auto_fill_ppq = self.filtered_domain( + [ + ("picking_type_id.automatic_done_packaging_calculation", "=", True), + ] + ) + auto_fill_ppq.product_packaging_quantity = 0 + for line in auto_fill_ppq: if not line.move_id.product_packaging_id: continue # Same as product_packaging_qty at the first time diff --git a/stock_move_packaging_qty/models/stock_picking_type.py b/stock_move_packaging_qty/models/stock_picking_type.py new file mode 100644 index 000000000000..156d6a3ec55e --- /dev/null +++ b/stock_move_packaging_qty/models/stock_picking_type.py @@ -0,0 +1,14 @@ +# Copyright 2026 Moduon Team S.L. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). +from odoo import fields, models + + +class StockPickingType(models.Model): + _inherit = "stock.picking.type" + + automatic_done_packaging_calculation = fields.Boolean( + string="Automatically Calculate Done Packaging Quantity", + default=True, + help="The system calculates Done Packaging Automatically on Stock Move Lines.\n" + "Disable this to prevent automatic calculation.", + ) diff --git a/stock_move_packaging_qty/static/description/index.html b/stock_move_packaging_qty/static/description/index.html index 8a1d46745dcc..e3a5bc94f3e7 100644 --- a/stock_move_packaging_qty/static/description/index.html +++ b/stock_move_packaging_qty/static/description/index.html @@ -3,7 +3,7 @@ -README.rst +Stock Packaging Qty -
+
+

Stock Packaging Qty

- - -Odoo Community Association - -
-

Stock Packaging Qty

-

Beta License: LGPL-3 OCA/stock-logistics-warehouse Translate me on Weblate Try me on Runboat

+

Beta License: LGPL-3 OCA/stock-logistics-warehouse Translate me on Weblate Try me on Runboat

Add packaging fields in the stock moves, their lines and their reports.

Table of contents

@@ -390,7 +385,7 @@

Stock Packaging Qty

-

Known issues / Roadmap

+

Known issues / Roadmap

  • Since we store done product packaging quantities in the stock move lines, we should be able to use this information in quants to provide @@ -398,7 +393,7 @@

    Known issues / Roadmap

-

Bug Tracker

+

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed @@ -406,16 +401,16 @@

Bug Tracker

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

-

Credits

+

Credits

-

Authors

+

Authors

  • ForgeFlow
  • Moduon
-

Maintainers

+

Maintainers

This module is maintained by the OCA.

Odoo Community Association @@ -440,6 +435,5 @@

Maintainers

-
diff --git a/stock_move_packaging_qty/tests/test_stock_move_packaging_qty.py b/stock_move_packaging_qty/tests/test_stock_move_packaging_qty.py index 0aca17fa692b..c8958d855c65 100644 --- a/stock_move_packaging_qty/tests/test_stock_move_packaging_qty.py +++ b/stock_move_packaging_qty/tests/test_stock_move_packaging_qty.py @@ -63,6 +63,15 @@ def test_product_packaging_quantity(self): self.env["stock.quant"]._update_available_quantity( self.product, self.stock_location, 10 ) + # Disable Automatic Done Packaging Calculation + picking.picking_type_id.automatic_done_packaging_calculation = False + picking.action_assign() + self.assertEqual( + picking.move_ids_without_package.product_packaging_quantity, 0.0 + ) + picking.do_unreserve() + # Re-Enable Automatic Done Packaging Calculation + picking.picking_type_id.automatic_done_packaging_calculation = True # Initial packaging quantity should be set picking.action_assign() self.assertEqual( diff --git a/stock_move_packaging_qty/views/stock_picking_type_view.xml b/stock_move_packaging_qty/views/stock_picking_type_view.xml new file mode 100644 index 000000000000..f3f57db923e2 --- /dev/null +++ b/stock_move_packaging_qty/views/stock_picking_type_view.xml @@ -0,0 +1,13 @@ + + + + stock.picking.type.form + stock.picking.type + + + + + + + +