diff --git a/README.md b/README.md index 560f1faa0..9be1af122 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,9 @@ addon | version | maintainers | summary [stock_delivery_note](stock_delivery_note/) | 19.0.1.0.0 | | This module allows to fill in a delivery note that will be displayed on delivery report [stock_move_value_report](stock_move_value_report/) | 19.0.1.0.0 | | Stock Move Cost Value Report [stock_picking_report_external_note](stock_picking_report_external_note/) | 19.0.1.0.0 | Shide | Adds a note in Stock Picking shown on external reports like Delivery Slip +[stock_picking_report_qty_undelivered](stock_picking_report_qty_undelivered/) | 19.0.1.0.0 | EmilioPascual rafaelbn | Print a summary of the undelivered quantity [stock_picking_report_valued](stock_picking_report_valued/) | 19.0.1.0.1 | | Adding Valued Picking on Delivery Slip report -[stock_product_demand_info](stock_product_demand_info/) | 19.0.1.1.0 | ivantodorovich | Past demand by configurable periods on product and orderpoint +[stock_product_demand_info](stock_product_demand_info/) | 19.0.1.1.0 | ivantodorovich | Past demand and next incoming date [//]: # (end addons) diff --git a/setup/_metapackage/pyproject.toml b/setup/_metapackage/pyproject.toml index 4a72dbca4..a1d1a860c 100644 --- a/setup/_metapackage/pyproject.toml +++ b/setup/_metapackage/pyproject.toml @@ -5,6 +5,7 @@ dependencies = [ "odoo-addon-stock_delivery_note==19.0.*", "odoo-addon-stock_move_value_report==19.0.*", "odoo-addon-stock_picking_report_external_note==19.0.*", + "odoo-addon-stock_picking_report_qty_undelivered==19.0.*", "odoo-addon-stock_picking_report_valued==19.0.*", "odoo-addon-stock_product_demand_info==19.0.*", ] diff --git a/stock_picking_report_qty_undelivered/README.rst b/stock_picking_report_qty_undelivered/README.rst new file mode 100644 index 000000000..b15e79da5 --- /dev/null +++ b/stock_picking_report_qty_undelivered/README.rst @@ -0,0 +1,138 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +========================================= +Stock Picking Report Undelivered Quantity +========================================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:025930860860cce22aee76909d98015a5947ff5e56fdbe325cc650b5ce0c9af1 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png + :target: https://odoo-community.org/page/development-status + :alt: Alpha +.. |badge2| image:: https://img.shields.io/badge/license-GPL--3-blue.png + :target: http://www.gnu.org/licenses/gpl-3.0-standalone.html + :alt: License: GPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--reporting-lightgray.png?logo=github + :target: https://github.com/OCA/stock-logistics-reporting/tree/19.0/stock_picking_report_qty_undelivered + :alt: OCA/stock-logistics-reporting +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/stock-logistics-reporting-19-0/stock-logistics-reporting-19-0-stock_picking_report_qty_undelivered + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-reporting&target_branch=19.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module extends the stock functionality and allows you to display a +summary of undeliverable products. + +.. IMPORTANT:: + This is an alpha version, the data model and design can change at any time without warning. + Only for development or testing purpose, do not use in production. + `More details on development status `_ + +**Table of contents** + +.. contents:: + :local: + +Use Cases / Context +=================== + +This module was developed because only products that have not yet been +delivered are printed on the delivery slip, i.e. products included in +backorder. + +With this module you can print a summary of the products that will not +be delivered even if the backorder is not created. + +It will be useful for you if if you do not always deliver the full +quantity ordered but you want to inform the customer of the products you +are unable to deliver. + +Configuration +============= + +To configure this module, you need to: + +1. Go to Inventory > Configuration > Operation Types. +2. Select an operation type. +3. Activate **'Print a summary with undelivered qty'** + +Usage +===== + +To use this module, you need to: + +1. Go to Inventory > Operations > Transfers. +2. Create new transfer. +3. Select any operation type and the customer or supplier. +4. Add an operation for a product with a quantity demand greater than + 1. +5. Click on *Mark as todo*. +6. Add less quantity done than the quantity demand. +7. Validate transfer. +8. Click on *No backorder* in wizard. +9. Print *Delivery Slip*. +10. The report will show a summary of the undelivered amount. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Moduon + +Contributors +------------ + +- Emilio Pascual (`Moduon `__) +- Rafael Blasco (`Moduon `__) + +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. + +.. |maintainer-EmilioPascual| image:: https://github.com/EmilioPascual.png?size=40px + :target: https://github.com/EmilioPascual + :alt: EmilioPascual +.. |maintainer-rafaelbn| image:: https://github.com/rafaelbn.png?size=40px + :target: https://github.com/rafaelbn + :alt: rafaelbn + +Current `maintainers `__: + +|maintainer-EmilioPascual| |maintainer-rafaelbn| + +This module is part of the `OCA/stock-logistics-reporting `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/stock_picking_report_qty_undelivered/__init__.py b/stock_picking_report_qty_undelivered/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/stock_picking_report_qty_undelivered/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/stock_picking_report_qty_undelivered/__manifest__.py b/stock_picking_report_qty_undelivered/__manifest__.py new file mode 100644 index 000000000..336e6fda5 --- /dev/null +++ b/stock_picking_report_qty_undelivered/__manifest__.py @@ -0,0 +1,23 @@ +# Copyright 2024 Moduon Team S.L. +# License GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0) + +{ + "name": "Stock Picking Report Undelivered Quantity", + "summary": "Print a summary of the undelivered quantity", + "version": "19.0.1.0.0", + "development_status": "Alpha", + "category": "Inventory/Delivery", + "website": "https://github.com/OCA/stock-logistics-reporting", + "author": "Moduon, Odoo Community Association (OCA)", + "maintainers": ["EmilioPascual", "rafaelbn"], + "license": "GPL-3", + "application": False, + "installable": True, + "depends": [ + "stock", + ], + "data": [ + "views/stock_picking_type_views.xml", + "views/report_deliveryslip.xml", + ], +} diff --git a/stock_picking_report_qty_undelivered/i18n/es.po b/stock_picking_report_qty_undelivered/i18n/es.po new file mode 100644 index 000000000..0a09278f7 --- /dev/null +++ b/stock_picking_report_qty_undelivered/i18n/es.po @@ -0,0 +1,48 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_picking_report_qty_undelivered +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-03-04 16:26+0000\n" +"PO-Revision-Date: 2024-03-04 17:28+0100\n" +"Last-Translator: Emilio Pascual \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 3.4.2\n" + +#. module: stock_picking_report_qty_undelivered +#: model_terms:ir.ui.view,arch_db:stock_picking_report_qty_undelivered.report_delivery_document_qty_not_done +msgid "Summary of undelivered quantities:" +msgstr "Resumen de cantidades no entregadas:" + +#. module: stock_picking_report_qty_undelivered +#: model_terms:ir.ui.view,arch_db:stock_picking_report_qty_undelivered.report_delivery_document_qty_not_done +msgid "Product" +msgstr "Producto" + +#. module: stock_picking_report_qty_undelivered +#: model_terms:ir.ui.view,arch_db:stock_picking_report_qty_undelivered.report_delivery_document_qty_not_done +msgid "Quantity" +msgstr "Cantidad" + +#. module: stock_picking_report_qty_undelivered +#: model:ir.model,name:stock_picking_report_qty_undelivered.model_stock_picking_type +msgid "Picking Type" +msgstr "Tipo de operación" + +#. module: stock_picking_report_qty_undelivered +#: model:ir.model.fields,field_description:stock_picking_report_qty_undelivered.field_stock_picking_type__summary_qty_undelivered +msgid "Print a summary with undelivered qty" +msgstr "Imprimir resumen con cantidad no entregada" + +#. module: stock_picking_report_qty_undelivered +#: model:ir.model.fields,help:stock_picking_report_qty_undelivered.field_stock_picking_type__summary_qty_undelivered +msgid "Print a summary with undelivered quantity in the picking report" +msgstr "Imprime un resumen con la cantidad no entregada en el informe del albarán" diff --git a/stock_picking_report_qty_undelivered/i18n/it.po b/stock_picking_report_qty_undelivered/i18n/it.po new file mode 100644 index 000000000..d0f9c6c47 --- /dev/null +++ b/stock_picking_report_qty_undelivered/i18n/it.po @@ -0,0 +1,48 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_picking_report_qty_undelivered +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-08-22 10:06+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 5.6.2\n" + +#. module: stock_picking_report_qty_undelivered +#: model_terms:ir.ui.view,arch_db:stock_picking_report_qty_undelivered.report_delivery_document_qty_not_done +msgid "Summary of undelivered quantities:" +msgstr "Riepilo delle quantità non consegnate:" + +#. module: stock_picking_report_qty_undelivered +#: model_terms:ir.ui.view,arch_db:stock_picking_report_qty_undelivered.report_delivery_document_qty_not_done +msgid "Product" +msgstr "Prodotto" + +#. module: stock_picking_report_qty_undelivered +#: model_terms:ir.ui.view,arch_db:stock_picking_report_qty_undelivered.report_delivery_document_qty_not_done +msgid "Quantity" +msgstr "Quantità" + +#. module: stock_picking_report_qty_undelivered +#: model:ir.model,name:stock_picking_report_qty_undelivered.model_stock_picking_type +msgid "Picking Type" +msgstr "Tipo prelievo" + +#. module: stock_picking_report_qty_undelivered +#: model:ir.model.fields,field_description:stock_picking_report_qty_undelivered.field_stock_picking_type__summary_qty_undelivered +msgid "Print a summary with undelivered qty" +msgstr "Stampa un riepilogo con le quantità non consegnate" + +#. module: stock_picking_report_qty_undelivered +#: model:ir.model.fields,help:stock_picking_report_qty_undelivered.field_stock_picking_type__summary_qty_undelivered +msgid "Print a summary with undelivered quantity in the picking report" +msgstr "" +"Stampa un riepilogo con le quantità non consegnate nel resoconto del prelievo" diff --git a/stock_picking_report_qty_undelivered/i18n/stock_picking_report_qty_undelivered.pot b/stock_picking_report_qty_undelivered/i18n/stock_picking_report_qty_undelivered.pot new file mode 100644 index 000000000..636b088d3 --- /dev/null +++ b/stock_picking_report_qty_undelivered/i18n/stock_picking_report_qty_undelivered.pot @@ -0,0 +1,44 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_picking_report_qty_undelivered +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 19.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_picking_report_qty_undelivered +#: model_terms:ir.ui.view,arch_db:stock_picking_report_qty_undelivered.report_delivery_document_qty_not_done +msgid "Summary of undelivered quantities:" +msgstr "" + +#. module: stock_picking_report_qty_undelivered +#: model_terms:ir.ui.view,arch_db:stock_picking_report_qty_undelivered.report_delivery_document_qty_not_done +msgid "Product" +msgstr "" + +#. module: stock_picking_report_qty_undelivered +#: model_terms:ir.ui.view,arch_db:stock_picking_report_qty_undelivered.report_delivery_document_qty_not_done +msgid "Quantity" +msgstr "" + +#. module: stock_picking_report_qty_undelivered +#: model:ir.model,name:stock_picking_report_qty_undelivered.model_stock_picking_type +msgid "Picking Type" +msgstr "" + +#. module: stock_picking_report_qty_undelivered +#: model:ir.model.fields,field_description:stock_picking_report_qty_undelivered.field_stock_picking_type__summary_qty_undelivered +msgid "Print a summary with undelivered qty" +msgstr "" + +#. module: stock_picking_report_qty_undelivered +#: model:ir.model.fields,help:stock_picking_report_qty_undelivered.field_stock_picking_type__summary_qty_undelivered +msgid "Print a summary with undelivered quantity in the picking report" +msgstr "" diff --git a/stock_picking_report_qty_undelivered/models/__init__.py b/stock_picking_report_qty_undelivered/models/__init__.py new file mode 100644 index 000000000..576c033a6 --- /dev/null +++ b/stock_picking_report_qty_undelivered/models/__init__.py @@ -0,0 +1 @@ +from . import stock_picking_type diff --git a/stock_picking_report_qty_undelivered/models/stock_picking_type.py b/stock_picking_report_qty_undelivered/models/stock_picking_type.py new file mode 100644 index 000000000..ab70e188b --- /dev/null +++ b/stock_picking_report_qty_undelivered/models/stock_picking_type.py @@ -0,0 +1,14 @@ +# Copyright 2024 Moduon Team S.L. +# License GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0) + + +from odoo import fields, models + + +class StockPickingType(models.Model): + _inherit = "stock.picking.type" + + summary_qty_undelivered = fields.Boolean( + "Print a summary with undelivered qty", + help="Print a summary with undelivered quantity in the picking report", + ) diff --git a/stock_picking_report_qty_undelivered/pyproject.toml b/stock_picking_report_qty_undelivered/pyproject.toml new file mode 100644 index 000000000..4231d0ccc --- /dev/null +++ b/stock_picking_report_qty_undelivered/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/stock_picking_report_qty_undelivered/readme/CONFIGURE.md b/stock_picking_report_qty_undelivered/readme/CONFIGURE.md new file mode 100644 index 000000000..b781647b0 --- /dev/null +++ b/stock_picking_report_qty_undelivered/readme/CONFIGURE.md @@ -0,0 +1,5 @@ +To configure this module, you need to: + +1. Go to Inventory > Configuration > Operation Types. +2. Select an operation type. +3. Activate **'Print a summary with undelivered qty'** diff --git a/stock_picking_report_qty_undelivered/readme/CONTEXT.md b/stock_picking_report_qty_undelivered/readme/CONTEXT.md new file mode 100644 index 000000000..9638b8812 --- /dev/null +++ b/stock_picking_report_qty_undelivered/readme/CONTEXT.md @@ -0,0 +1,5 @@ +This module was developed because only products that have not yet been delivered are printed on the delivery slip, i.e. products included in backorder. + +With this module you can print a summary of the products that will not be delivered even if the backorder is not created. + +It will be useful for you if if you do not always deliver the full quantity ordered but you want to inform the customer of the products you are unable to deliver. diff --git a/stock_picking_report_qty_undelivered/readme/CONTRIBUTORS.md b/stock_picking_report_qty_undelivered/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..dce7667b2 --- /dev/null +++ b/stock_picking_report_qty_undelivered/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- Emilio Pascual ([Moduon](https://www.moduon.team/)) +- Rafael Blasco ([Moduon](https://www.moduon.team/)) diff --git a/stock_picking_report_qty_undelivered/readme/DESCRIPTION.md b/stock_picking_report_qty_undelivered/readme/DESCRIPTION.md new file mode 100644 index 000000000..40e94efca --- /dev/null +++ b/stock_picking_report_qty_undelivered/readme/DESCRIPTION.md @@ -0,0 +1 @@ +This module extends the stock functionality and allows you to display a summary of undeliverable products. \ No newline at end of file diff --git a/stock_picking_report_qty_undelivered/readme/USAGE.md b/stock_picking_report_qty_undelivered/readme/USAGE.md new file mode 100644 index 000000000..e675fe870 --- /dev/null +++ b/stock_picking_report_qty_undelivered/readme/USAGE.md @@ -0,0 +1,12 @@ +To use this module, you need to: + +1. Go to Inventory > Operations > Transfers. +2. Create new transfer. +3. Select any operation type and the customer or supplier. +4. Add an operation for a product with a quantity demand greater than 1. +5. Click on *Mark as todo*. +6. Add less quantity done than the quantity demand. +7. Validate transfer. +8. Click on *No backorder* in wizard. +9. Print *Delivery Slip*. +10. The report will show a summary of the undelivered amount. \ No newline at end of file diff --git a/stock_picking_report_qty_undelivered/static/description/icon.png b/stock_picking_report_qty_undelivered/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/stock_picking_report_qty_undelivered/static/description/icon.png differ diff --git a/stock_picking_report_qty_undelivered/static/description/index.html b/stock_picking_report_qty_undelivered/static/description/index.html new file mode 100644 index 000000000..0da908744 --- /dev/null +++ b/stock_picking_report_qty_undelivered/static/description/index.html @@ -0,0 +1,479 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

Stock Picking Report Undelivered Quantity

+ +

Alpha License: GPL-3 OCA/stock-logistics-reporting Translate me on Weblate Try me on Runboat

+

This module extends the stock functionality and allows you to display a +summary of undeliverable products.

+
+

Important

+

This is an alpha version, the data model and design can change at any time without warning. +Only for development or testing purpose, do not use in production. +More details on development status

+
+

Table of contents

+ +
+

Use Cases / Context

+

This module was developed because only products that have not yet been +delivered are printed on the delivery slip, i.e. products included in +backorder.

+

With this module you can print a summary of the products that will not +be delivered even if the backorder is not created.

+

It will be useful for you if if you do not always deliver the full +quantity ordered but you want to inform the customer of the products you +are unable to deliver.

+
+
+

Configuration

+

To configure this module, you need to:

+
    +
  1. Go to Inventory > Configuration > Operation Types.
  2. +
  3. Select an operation type.
  4. +
  5. Activate ‘Print a summary with undelivered qty’
  6. +
+
+
+

Usage

+

To use this module, you need to:

+
    +
  1. Go to Inventory > Operations > Transfers.
  2. +
  3. Create new transfer.
  4. +
  5. Select any operation type and the customer or supplier.
  6. +
  7. Add an operation for a product with a quantity demand greater than +1.
  8. +
  9. Click on Mark as todo.
  10. +
  11. Add less quantity done than the quantity demand.
  12. +
  13. Validate transfer.
  14. +
  15. Click on No backorder in wizard.
  16. +
  17. Print Delivery Slip.
  18. +
  19. The report will show a summary of the undelivered amount.
  20. +
+
+
+

Bug Tracker

+

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

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Moduon
  • +
+
+
+

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.

+

Current maintainers:

+

EmilioPascual rafaelbn

+

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

+

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

+
+
+
+
+ + diff --git a/stock_picking_report_qty_undelivered/tests/__init__.py b/stock_picking_report_qty_undelivered/tests/__init__.py new file mode 100644 index 000000000..396fd9164 --- /dev/null +++ b/stock_picking_report_qty_undelivered/tests/__init__.py @@ -0,0 +1 @@ +from . import test_stock_picking_report_qty_undelivered diff --git a/stock_picking_report_qty_undelivered/tests/test_stock_picking_report_qty_undelivered.py b/stock_picking_report_qty_undelivered/tests/test_stock_picking_report_qty_undelivered.py new file mode 100644 index 000000000..8e5cbc32a --- /dev/null +++ b/stock_picking_report_qty_undelivered/tests/test_stock_picking_report_qty_undelivered.py @@ -0,0 +1,121 @@ +# Copyright 2024 Moduon Team S.L. +# License GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0) + + +from odoo.tests.common import TransactionCase + + +class TestReportQtyUndelivered(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.partner = cls.env["res.partner"].create({"name": "Test Partner"}) + cls.product1 = cls.env["product.product"].create( + {"name": "Product Test 1", "type": "consu", "is_storable": True} + ) + cls.product2 = cls.env["product.product"].create( + { + "name": "Product Test 2", + "type": "consu", + "is_storable": True, + } + ) + cls.customer_location = cls.env.ref("stock.stock_location_customers") + cls.stock_location = cls.env.ref("stock.stock_location_stock") + cls.picking_type_out = cls.env.ref("stock.picking_type_out") + + def _create_done_picking_without_backorder(self): + self.env["stock.quant"]._update_available_quantity( + self.product1, self.stock_location, 10 + ) + self.env["stock.quant"]._update_available_quantity( + self.product2, self.stock_location, 10 + ) + picking = self.env["stock.picking"].create( + { + "partner_id": self.partner.id, + "location_id": self.stock_location.id, + "location_dest_id": self.customer_location.id, + "picking_type_id": self.picking_type_out.id, + "move_ids": [ + ( + 0, + 0, + { + "product_id": self.product1.id, + "product_uom": self.product1.uom_id.id, + "location_id": self.stock_location.id, + "location_dest_id": self.customer_location.id, + "product_uom_qty": 10, + "quantity": 4, + }, + ), + ( + 0, + 0, + { + "product_id": self.product2.id, + "product_uom": self.product1.uom_id.id, + "location_id": self.stock_location.id, + "location_dest_id": self.customer_location.id, + "product_uom_qty": 10, + "quantity": 10, + }, + ), + ], + } + ) + picking.action_confirm() + picking.action_assign() + picking.move_ids.filtered( + lambda move: move.product_id == self.product1 + ).quantity = 4 + picking.with_context( + skip_backorder=True, picking_ids_not_to_backorder=picking.ids + ).button_validate() + return picking + + def _render_delivery_html(self, picking): + html, _report_type = self.env["ir.actions.report"]._render_qweb_html( + "stock.action_report_delivery", picking.ids + ) + return html.decode() if isinstance(html, bytes) else html + + def test_report_qty_not_delivered(self): + """Test delivery""" + picking = self._create_done_picking_without_backorder() + report_html = self._render_delivery_html(picking) + self.assertNotIn("Summary of undelivered quantities:", report_html) + self.picking_type_out.summary_qty_undelivered = True + report_html = self._render_delivery_html(picking) + summary_html = report_html.split("Summary of undelivered quantities:")[1] + self.assertIn("Summary of undelivered quantities:", report_html) + self.assertIn("Product Test 1", summary_html) + self.assertNotIn("Product Test 2", summary_html) + + def test_report_qty_not_delivered_pdf_smoke(self): + picking = self._create_done_picking_without_backorder() + self.picking_type_out.summary_qty_undelivered = True + wkhtmltopdf_state = self.env["ir.actions.report"].get_wkhtmltopdf_state() + if wkhtmltopdf_state != "ok": # pragma: no cover + self.skipTest(f"wkhtmltopdf is not ready: {wkhtmltopdf_state}") + with self.allow_pdf_render(): + report_pdf, report_type = ( + self.env["ir.actions.report"] + .with_context(force_report_rendering=True) + ._render_qweb_pdf("stock.action_report_delivery", picking.ids) + ) + self.assertEqual(report_type, "pdf") + self.assertTrue(report_pdf) + + def test_report_qty_not_delivered_aggregated_ordered_quantity(self): + picking = self._create_done_picking_without_backorder() + self.picking_type_out.summary_qty_undelivered = True + report_html = self._render_delivery_html(picking) + product_html = report_html.split("Product Test 1")[1].split("Product Test 2")[0] + self.assertIn(">10<", product_html) + self.assertIn(">4<", product_html) + self.assertIn( + "Summary of undelivered quantities:", + report_html, + ) diff --git a/stock_picking_report_qty_undelivered/views/report_deliveryslip.xml b/stock_picking_report_qty_undelivered/views/report_deliveryslip.xml new file mode 100644 index 000000000..d75e6b8d8 --- /dev/null +++ b/stock_picking_report_qty_undelivered/views/report_deliveryslip.xml @@ -0,0 +1,107 @@ + + + + + + + diff --git a/stock_picking_report_qty_undelivered/views/stock_picking_type_views.xml b/stock_picking_report_qty_undelivered/views/stock_picking_type_views.xml new file mode 100644 index 000000000..ea51efc35 --- /dev/null +++ b/stock_picking_report_qty_undelivered/views/stock_picking_type_views.xml @@ -0,0 +1,15 @@ + + + + + Stock Picking Type Qty Not Done + stock.picking.type + + + + + + + +