From 0aac0598de9bcb32f26ec9121f4a2ac3f66648ec Mon Sep 17 00:00:00 2001 From: Sergio Teruel Date: Thu, 30 Jul 2020 14:49:00 +0200 Subject: [PATCH] [ADD] stock_picking_report_undelivered_product: New module to display undelivered products in delivery slip report --- .../README.rst | 103 ++++ .../__init__.py | 2 + .../__manifest__.py | 22 + .../i18n/es.po | 115 +++++ ...ock_picking_report_undelivered_product.pot | 111 +++++ .../models/__init__.py | 4 + .../models/product_template.py | 13 + .../models/res_config_settings.py | 37 ++ .../models/res_partner.py | 13 + .../models/stock_move.py | 22 + .../readme/CONTRIBUTORS.rst | 4 + .../readme/DESCRIPTION.rst | 11 + .../readme/USAGE.rst | 13 + .../static/description/index.html | 454 ++++++++++++++++++ .../tests/__init__.py | 3 + ...tock_picking_report_undelivered_product.py | 172 +++++++ .../views/product_views.xml | 14 + .../views/report_deliveryslip.xml | 53 ++ .../views/res_config_settings_views.xml | 28 ++ .../views/res_partner_view.xml | 15 + 20 files changed, 1209 insertions(+) create mode 100644 stock_picking_report_undelivered_product/README.rst create mode 100644 stock_picking_report_undelivered_product/__init__.py create mode 100644 stock_picking_report_undelivered_product/__manifest__.py create mode 100644 stock_picking_report_undelivered_product/i18n/es.po create mode 100644 stock_picking_report_undelivered_product/i18n/stock_picking_report_undelivered_product.pot create mode 100644 stock_picking_report_undelivered_product/models/__init__.py create mode 100644 stock_picking_report_undelivered_product/models/product_template.py create mode 100644 stock_picking_report_undelivered_product/models/res_config_settings.py create mode 100644 stock_picking_report_undelivered_product/models/res_partner.py create mode 100644 stock_picking_report_undelivered_product/models/stock_move.py create mode 100644 stock_picking_report_undelivered_product/readme/CONTRIBUTORS.rst create mode 100644 stock_picking_report_undelivered_product/readme/DESCRIPTION.rst create mode 100644 stock_picking_report_undelivered_product/readme/USAGE.rst create mode 100644 stock_picking_report_undelivered_product/static/description/index.html create mode 100644 stock_picking_report_undelivered_product/tests/__init__.py create mode 100644 stock_picking_report_undelivered_product/tests/test_stock_picking_report_undelivered_product.py create mode 100644 stock_picking_report_undelivered_product/views/product_views.xml create mode 100644 stock_picking_report_undelivered_product/views/report_deliveryslip.xml create mode 100644 stock_picking_report_undelivered_product/views/res_config_settings_views.xml create mode 100644 stock_picking_report_undelivered_product/views/res_partner_view.xml diff --git a/stock_picking_report_undelivered_product/README.rst b/stock_picking_report_undelivered_product/README.rst new file mode 100644 index 0000000..0769693 --- /dev/null +++ b/stock_picking_report_undelivered_product/README.rst @@ -0,0 +1,103 @@ +========================================= +Stock picking report undelivered products +========================================= + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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--reporting-lightgray.png?logo=github + :target: https://github.com/OCA/stock-logistics-reporting/tree/12.0/stock_picking_report_undelivered_product + :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-12-0/stock-logistics-reporting-12-0-stock_picking_report_undelivered_product + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/151/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module extends the functionality of stock module to allow to +display undelivered products in the delivery slip report. + +You have three options to display lines: + +* Display all undelivered product lines. +* Display only partially undelivered product lines. +* Display only completely undelivered product lines. + +You can choose by partner and product if you want to display undelivered +products. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +#. Go to *'Inventory > Configuration > Settings'*. +#. Select the option to display lines (All, only partially lines or only + completely lines). +#. Go to *'Sales > Orders > Customers'*. +#. Check "Display undelivered in picking" in a customer. +#. Go to *'Sales > Catalog > Products'*. +#. Check "Display undelivered in picking" in a product. +#. Go to *'Sales > Orders > Order'*. +#. Do a order for this customer with a product with the + "Display undelivered in picking" field checked. +#. Confirm the order. +#. Open the related picking and print the "Delivery slip". +#. Now you can view in report products that have not been sent. + +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 `_: + + * Sergio Teruel + * Carlos Dauden + +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-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_undelivered_product/__init__.py b/stock_picking_report_undelivered_product/__init__.py new file mode 100644 index 0000000..6ed64d8 --- /dev/null +++ b/stock_picking_report_undelivered_product/__init__.py @@ -0,0 +1,2 @@ +# Copyright 2020 Sergio Teruel - Tecnativa +from . import models diff --git a/stock_picking_report_undelivered_product/__manifest__.py b/stock_picking_report_undelivered_product/__manifest__.py new file mode 100644 index 0000000..90ac16e --- /dev/null +++ b/stock_picking_report_undelivered_product/__manifest__.py @@ -0,0 +1,22 @@ +# Copyright 2020 Sergio Teruel - Tecnativa +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Stock picking report undelivered products", + "summary": "Display on picking report delivery slip undelivered products", + "version": "12.0.1.0.0", + "author": "Tecnativa,Odoo Community Association (OCA)", + "website": "https://www.tecnativa.com", + "category": "Warehouse", + "license": "AGPL-3", + "depends": [ + "stock", + ], + "data": [ + 'views/product_views.xml', + 'views/report_deliveryslip.xml', + 'views/res_config_settings_views.xml', + 'views/res_partner_view.xml', + ], + 'installable': True, +} diff --git a/stock_picking_report_undelivered_product/i18n/es.po b/stock_picking_report_undelivered_product/i18n/es.po new file mode 100644 index 0000000..cea33c6 --- /dev/null +++ b/stock_picking_report_undelivered_product/i18n/es.po @@ -0,0 +1,115 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_picking_report_undelivered_product +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-09-18 22:21+0000\n" +"PO-Revision-Date: 2020-09-19 00:26+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_report_undelivered_product +#: model_terms:ir.ui.view,arch_db:stock_picking_report_undelivered_product.undeliverd_product +msgid "Product" +msgstr "Producto" + +#. module: stock_picking_report_undelivered_product +#: model_terms:ir.ui.view,arch_db:stock_picking_report_undelivered_product.undeliverd_product +msgid "Quantity" +msgstr "Cantidad" + +#. module: stock_picking_report_undelivered_product +#: model_terms:ir.ui.view,arch_db:stock_picking_report_undelivered_product.undeliverd_product +msgid "Reference" +msgstr "Referencia" + +#. module: stock_picking_report_undelivered_product +#: model_terms:ir.ui.view,arch_db:stock_picking_report_undelivered_product.undeliverd_product +msgid "Remaining products (not delivered yet)" +msgstr "Productos no enviados" + +#. module: stock_picking_report_undelivered_product +#: model:ir.model,name:stock_picking_report_undelivered_product.model_res_company +msgid "Companies" +msgstr "Compañías" + +#. module: stock_picking_report_undelivered_product +#: model:ir.model,name:stock_picking_report_undelivered_product.model_res_config_settings +msgid "Config Settings" +msgstr "Ajustes de configuración" + +#. module: stock_picking_report_undelivered_product +#: model:ir.model,name:stock_picking_report_undelivered_product.model_res_partner +msgid "Contact" +msgstr "Contacto" + +#. module: stock_picking_report_undelivered_product +#: selection:res.company,undelivered_product_slip_report_method:0 +msgid "Display all undelivered product lines" +msgstr "Mostrar todas las líneas de productos no enviados en el albarán" + +#. module: stock_picking_report_undelivered_product +#: selection:res.company,undelivered_product_slip_report_method:0 +msgid "Display only completely undelivered product lines" +msgstr "Mostrar solo líneas de productos completamente no enviados en el albarán" + +#. module: stock_picking_report_undelivered_product +#: selection:res.company,undelivered_product_slip_report_method:0 +msgid "Display only partially undelivered product lines" +msgstr "Mostrar solo lineas de productos parcialmente no enviados en el albarán" + +#. module: stock_picking_report_undelivered_product +#: model:ir.model.fields,field_description:stock_picking_report_undelivered_product.field_product_product__display_undelivered_in_picking +#: model:ir.model.fields,field_description:stock_picking_report_undelivered_product.field_product_template__display_undelivered_in_picking +#: model:ir.model.fields,field_description:stock_picking_report_undelivered_product.field_res_partner__display_undelivered_in_picking +#: model:ir.model.fields,field_description:stock_picking_report_undelivered_product.field_res_users__display_undelivered_in_picking +msgid "Display undelivered in picking" +msgstr "Mostrar productos no enviados en el albarán" + +#. module: stock_picking_report_undelivered_product +#: model:ir.model.fields,field_description:stock_picking_report_undelivered_product.field_res_company__undelivered_product_slip_report_method +#: model:ir.model.fields,field_description:stock_picking_report_undelivered_product.field_res_config_settings__undelivered_product_slip_report_method +msgid "Method to display undelivered product lines in report picking" +msgstr "Método para mostrar los productos no enviados en el albarán" + +#. module: stock_picking_report_undelivered_product +#: model:ir.model,name:stock_picking_report_undelivered_product.model_product_template +msgid "Product Template" +msgstr "Plantilla de producto" + +#. module: stock_picking_report_undelivered_product +#: model_terms:ir.ui.view,arch_db:stock_picking_report_undelivered_product.res_config_settings_view_form +msgid "Report picking undelivered products" +msgstr "Productos no enviados en el albarán" + +#. module: stock_picking_report_undelivered_product +#: model_terms:ir.ui.view,arch_db:stock_picking_report_undelivered_product.res_config_settings_view_form +msgid "Select method to display undelivered product lines" +msgstr "Seleccione el método para mostrar líneas de productos no enviados" + +#. module: stock_picking_report_undelivered_product +#: model:ir.model.fields,field_description:stock_picking_report_undelivered_product.field_stock_move__splitted_stock_move_orig_id +msgid "Splitted from" +msgstr "Dividido desde" + +#. module: stock_picking_report_undelivered_product +#: model:ir.model,name:stock_picking_report_undelivered_product.model_stock_move +msgid "Stock Move" +msgstr "Movimiento de stock" + +#. module: stock_picking_report_undelivered_product +#: model_terms:ir.ui.view,arch_db:stock_picking_report_undelivered_product.res_config_settings_view_form +msgid "Undelivered product lines in delivery slip report" +msgstr "Líneas de productos no enviados en el albarán" + +#~ msgid "Is splitted" +#~ msgstr "Es dividido" diff --git a/stock_picking_report_undelivered_product/i18n/stock_picking_report_undelivered_product.pot b/stock_picking_report_undelivered_product/i18n/stock_picking_report_undelivered_product.pot new file mode 100644 index 0000000..2e0c1e2 --- /dev/null +++ b/stock_picking_report_undelivered_product/i18n/stock_picking_report_undelivered_product.pot @@ -0,0 +1,111 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_picking_report_undelivered_product +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-09-18 22:21+0000\n" +"PO-Revision-Date: 2020-09-18 22:21+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_report_undelivered_product +#: model_terms:ir.ui.view,arch_db:stock_picking_report_undelivered_product.undeliverd_product +msgid "Product" +msgstr "" + +#. module: stock_picking_report_undelivered_product +#: model_terms:ir.ui.view,arch_db:stock_picking_report_undelivered_product.undeliverd_product +msgid "Quantity" +msgstr "" + +#. module: stock_picking_report_undelivered_product +#: model_terms:ir.ui.view,arch_db:stock_picking_report_undelivered_product.undeliverd_product +msgid "Reference" +msgstr "" + +#. module: stock_picking_report_undelivered_product +#: model_terms:ir.ui.view,arch_db:stock_picking_report_undelivered_product.undeliverd_product +msgid "Remaining products (not delivered yet)" +msgstr "" + +#. module: stock_picking_report_undelivered_product +#: model:ir.model,name:stock_picking_report_undelivered_product.model_res_company +msgid "Companies" +msgstr "" + +#. module: stock_picking_report_undelivered_product +#: model:ir.model,name:stock_picking_report_undelivered_product.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: stock_picking_report_undelivered_product +#: model:ir.model,name:stock_picking_report_undelivered_product.model_res_partner +msgid "Contact" +msgstr "" + +#. module: stock_picking_report_undelivered_product +#: selection:res.company,undelivered_product_slip_report_method:0 +msgid "Display all undelivered product lines" +msgstr "" + +#. module: stock_picking_report_undelivered_product +#: selection:res.company,undelivered_product_slip_report_method:0 +msgid "Display only completely undelivered product lines" +msgstr "" + +#. module: stock_picking_report_undelivered_product +#: selection:res.company,undelivered_product_slip_report_method:0 +msgid "Display only partially undelivered product lines" +msgstr "" + +#. module: stock_picking_report_undelivered_product +#: model:ir.model.fields,field_description:stock_picking_report_undelivered_product.field_product_product__display_undelivered_in_picking +#: model:ir.model.fields,field_description:stock_picking_report_undelivered_product.field_product_template__display_undelivered_in_picking +#: model:ir.model.fields,field_description:stock_picking_report_undelivered_product.field_res_partner__display_undelivered_in_picking +#: model:ir.model.fields,field_description:stock_picking_report_undelivered_product.field_res_users__display_undelivered_in_picking +msgid "Display undelivered in picking" +msgstr "" + +#. module: stock_picking_report_undelivered_product +#: model:ir.model.fields,field_description:stock_picking_report_undelivered_product.field_res_company__undelivered_product_slip_report_method +#: model:ir.model.fields,field_description:stock_picking_report_undelivered_product.field_res_config_settings__undelivered_product_slip_report_method +msgid "Method to display undelivered product lines in report picking" +msgstr "" + +#. module: stock_picking_report_undelivered_product +#: model:ir.model,name:stock_picking_report_undelivered_product.model_product_template +msgid "Product Template" +msgstr "" + +#. module: stock_picking_report_undelivered_product +#: model_terms:ir.ui.view,arch_db:stock_picking_report_undelivered_product.res_config_settings_view_form +msgid "Report picking undelivered products" +msgstr "" + +#. module: stock_picking_report_undelivered_product +#: model_terms:ir.ui.view,arch_db:stock_picking_report_undelivered_product.res_config_settings_view_form +msgid "Select method to display undelivered product lines" +msgstr "" + +#. module: stock_picking_report_undelivered_product +#: model:ir.model.fields,field_description:stock_picking_report_undelivered_product.field_stock_move__splitted_stock_move_orig_id +msgid "Splitted from" +msgstr "" + +#. module: stock_picking_report_undelivered_product +#: model:ir.model,name:stock_picking_report_undelivered_product.model_stock_move +msgid "Stock Move" +msgstr "" + +#. module: stock_picking_report_undelivered_product +#: model_terms:ir.ui.view,arch_db:stock_picking_report_undelivered_product.res_config_settings_view_form +msgid "Undelivered product lines in delivery slip report" +msgstr "" + diff --git a/stock_picking_report_undelivered_product/models/__init__.py b/stock_picking_report_undelivered_product/models/__init__.py new file mode 100644 index 0000000..2096132 --- /dev/null +++ b/stock_picking_report_undelivered_product/models/__init__.py @@ -0,0 +1,4 @@ +from . import product_template +from . import res_config_settings +from . import res_partner +from . import stock_move diff --git a/stock_picking_report_undelivered_product/models/product_template.py b/stock_picking_report_undelivered_product/models/product_template.py new file mode 100644 index 0000000..6a1b0dd --- /dev/null +++ b/stock_picking_report_undelivered_product/models/product_template.py @@ -0,0 +1,13 @@ +# Copyright 2020 Tecnativa - Sergio Teruel +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ProductTemplate(models.Model): + _inherit = 'product.template' + + display_undelivered_in_picking = fields.Boolean( + string='Display undelivered in picking', + default=True, + ) diff --git a/stock_picking_report_undelivered_product/models/res_config_settings.py b/stock_picking_report_undelivered_product/models/res_config_settings.py new file mode 100644 index 0000000..0a4b3cb --- /dev/null +++ b/stock_picking_report_undelivered_product/models/res_config_settings.py @@ -0,0 +1,37 @@ +# Copyright 2020 Tecnativa - Sergio Teruel +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = 'res.config.settings' + + undelivered_product_slip_report_method = fields.Selection( + [ + ('all', 'Display all undelivered product lines'), + ('partially_undelivered', + 'Display only partially undelivered product lines'), + ('completely_undelivered', + 'Display only completely undelivered product lines'), + ], + string='Method to display undelivered product lines in report picking', + related="company_id.undelivered_product_slip_report_method", + readonly=False, + ) + + +class Company(models.Model): + _inherit = "res.company" + + undelivered_product_slip_report_method = fields.Selection( + [ + ('all', 'Display all undelivered product lines'), + ('partially_undelivered', + 'Display only partially undelivered product lines'), + ('completely_undelivered', + 'Display only completely undelivered product lines'), + ], + string='Method to display undelivered product lines in report picking', + default='all' + ) diff --git a/stock_picking_report_undelivered_product/models/res_partner.py b/stock_picking_report_undelivered_product/models/res_partner.py new file mode 100644 index 0000000..fd76573 --- /dev/null +++ b/stock_picking_report_undelivered_product/models/res_partner.py @@ -0,0 +1,13 @@ +# Copyright 2020 Tecnativa - Sergio Teruel +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ResPartner(models.Model): + _inherit = 'res.partner' + + display_undelivered_in_picking = fields.Boolean( + string='Display undelivered in picking', + default=True, + ) diff --git a/stock_picking_report_undelivered_product/models/stock_move.py b/stock_picking_report_undelivered_product/models/stock_move.py new file mode 100644 index 0000000..29419ab --- /dev/null +++ b/stock_picking_report_undelivered_product/models/stock_move.py @@ -0,0 +1,22 @@ +# Copyright 2020 Tecnativa - Sergio Teruel +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class StockMove(models.Model): + _inherit = 'stock.move' + + splitted_stock_move_orig_id = fields.Many2one( + comodel_name='stock.move', + string="Splitted from", + readonly=True, + ) + + def _prepare_move_split_vals(self, qty): + """ + Store origin stock move which create splitted move. + """ + vals = super(StockMove, self)._prepare_move_split_vals(qty) + vals['splitted_stock_move_orig_id'] = self.id + return vals diff --git a/stock_picking_report_undelivered_product/readme/CONTRIBUTORS.rst b/stock_picking_report_undelivered_product/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000..ecbdebf --- /dev/null +++ b/stock_picking_report_undelivered_product/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* `Tecnativa `_: + + * Sergio Teruel + * Carlos Dauden diff --git a/stock_picking_report_undelivered_product/readme/DESCRIPTION.rst b/stock_picking_report_undelivered_product/readme/DESCRIPTION.rst new file mode 100644 index 0000000..71cd0e4 --- /dev/null +++ b/stock_picking_report_undelivered_product/readme/DESCRIPTION.rst @@ -0,0 +1,11 @@ +This module extends the functionality of stock module to allow to +display undelivered products in the delivery slip report. + +You have three options to display lines: + +* Display all undelivered product lines. +* Display only partially undelivered product lines. +* Display only completely undelivered product lines. + +You can choose by partner and product if you want to display undelivered +products. diff --git a/stock_picking_report_undelivered_product/readme/USAGE.rst b/stock_picking_report_undelivered_product/readme/USAGE.rst new file mode 100644 index 0000000..bbea5b6 --- /dev/null +++ b/stock_picking_report_undelivered_product/readme/USAGE.rst @@ -0,0 +1,13 @@ +#. Go to *'Inventory > Configuration > Settings'*. +#. Select the option to display lines (All, only partially lines or only + completely lines). +#. Go to *'Sales > Orders > Customers'*. +#. Check "Display undelivered in picking" in a customer. +#. Go to *'Sales > Catalog > Products'*. +#. Check "Display undelivered in picking" in a product. +#. Go to *'Sales > Orders > Order'*. +#. Do a order for this customer with a product with the + "Display undelivered in picking" field checked. +#. Confirm the order. +#. Open the related picking and print the "Delivery slip". +#. Now you can view in report products that have not been sent. diff --git a/stock_picking_report_undelivered_product/static/description/index.html b/stock_picking_report_undelivered_product/static/description/index.html new file mode 100644 index 0000000..c3892d3 --- /dev/null +++ b/stock_picking_report_undelivered_product/static/description/index.html @@ -0,0 +1,454 @@ + + + + + + +Stock picking report undelivered products + + + +
+

Stock picking report undelivered products

+ + +

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

+

This module extends the functionality of stock module to allow to +display undelivered products in the delivery slip report.

+

You have three options to display lines:

+
    +
  • Display all undelivered product lines.
  • +
  • Display only partially undelivered product lines.
  • +
  • Display only completely undelivered product lines.
  • +
+

You can choose by partner and product if you want to display undelivered +products.

+

Table of contents

+ +
+

Usage

+
    +
  1. Go to ‘Inventory > Configuration > Settings’.
  2. +
  3. Select the option to display lines (All, only partially lines or only +completely lines).
  4. +
  5. Go to ‘Sales > Orders > Customers’.
  6. +
  7. Check “Display undelivered in picking” in a customer.
  8. +
  9. Go to ‘Sales > Catalog > Products’.
  10. +
  11. Check “Display undelivered in picking” in a product.
  12. +
  13. Go to ‘Sales > Orders > Order’.
  14. +
  15. Do a order for this customer with a product with the +“Display undelivered in picking” field checked.
  16. +
  17. Confirm the order.
  18. +
  19. Open the related picking and print the “Delivery slip”.
  20. +
  21. Now you can view in report products that have not been sent.
  22. +
+
+
+

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

+ +
+
+

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-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_undelivered_product/tests/__init__.py b/stock_picking_report_undelivered_product/tests/__init__.py new file mode 100644 index 0000000..d958c8f --- /dev/null +++ b/stock_picking_report_undelivered_product/tests/__init__.py @@ -0,0 +1,3 @@ +# Copyright 2020 Sergio Teruel - Tecnativa + +from . import test_stock_picking_report_undelivered_product diff --git a/stock_picking_report_undelivered_product/tests/test_stock_picking_report_undelivered_product.py b/stock_picking_report_undelivered_product/tests/test_stock_picking_report_undelivered_product.py new file mode 100644 index 0000000..aa1a8b8 --- /dev/null +++ b/stock_picking_report_undelivered_product/tests/test_stock_picking_report_undelivered_product.py @@ -0,0 +1,172 @@ +# Copyright 2020 Sergio Teruel - Tecnativa +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo.tests import common +from odoo.tests.common import Form + + +class TestStockPickingReportUndeliveredProduct(common.TransactionCase): + + def setUp(self): + super().setUp() + self.ResPartner = self.env['res.partner'] + self.ProductProduct = self.env['product.product'] + self.StockPicking = self.env['stock.picking'] + self.StockQuant = self.env['stock.quant'] + + self.warehouse = self.env.ref('stock.warehouse0') + self.stock_location = self.env.ref('stock.stock_location_stock') + self.customer_location = self.env.ref('stock.stock_location_customers') + self.picking_type_out = self.env.ref('stock.picking_type_out') + + self.partner_display = self.ResPartner.create({ + 'name': 'Partner for test display', + 'customer': True, + 'display_undelivered_in_picking': True, + }) + self.partner_no_display = self.ResPartner.create({ + 'name': 'Partner for test on display', + 'customer': True, + 'display_undelivered_in_picking': False, + }) + + self.product_display = self.ProductProduct.create({ + 'name': 'Test product undelivered display', + 'display_undelivered_in_picking': True, + 'type': 'product', + }) + self.product_no_display = self.ProductProduct.create({ + 'name': 'Test product undelivered no display', + 'display_undelivered_in_picking': False, + 'type': 'product', + }) + self.product_no_display_wo_stock = self.ProductProduct.create({ + 'name': 'Test product undelivered no display without stock', + 'display_undelivered_in_picking': False, + 'type': 'product', + }) + self.StockQuant.create({ + 'product_id': self.product_no_display.id, + 'location_id': self.warehouse.lot_stock_id.id, + 'quantity': 2000, + }) + + def _create_picking(self, partner): + picking_form = Form(self.StockPicking) + picking_form.picking_type_id = self.picking_type_out + picking_form.partner_id = partner + + with picking_form.move_ids_without_package.new() as line: + line.product_id = self.product_display + line.product_uom_qty = 50.00 + with picking_form.move_ids_without_package.new() as line: + line.product_id = self.product_no_display + line.product_uom_qty = 20.00 + with picking_form.move_ids_without_package.new() as line: + line.product_id = self.product_no_display_wo_stock + line.product_uom_qty = 20.00 + return picking_form.save() + + def test_displayed_customer(self): + picking = self._create_picking(self.partner_display) + picking.action_confirm() + picking.action_assign() + picking.move_line_ids.qty_done = 10.00 + picking.action_done() + # Cancel backorder + picking.backorder_ids.action_cancel() + res = self.env['ir.actions.report']._get_report_from_name( + 'stock.report_deliveryslip' + ).render_qweb_html(picking.ids) + self.assertIn("undelivered_product", str(res[0])) + + def test_no_displayed_customer(self): + picking = self._create_picking(self.partner_no_display) + picking.action_confirm() + picking.action_assign() + picking.move_line_ids.qty_done = 10.00 + picking.action_done() + # Cancel backorder + picking.backorder_ids.action_cancel() + res = self.env['ir.actions.report']._get_report_from_name( + 'stock.report_deliveryslip' + ).render_qweb_html(picking.ids) + self.assertNotIn("undelivered_product", str(res[0])) + + def test_no_displayed_product(self): + picking = self._create_picking(self.partner_display) + picking.move_lines.filtered( + lambda l: l.product_id == self.product_display).unlink() + picking.action_confirm() + picking.action_assign() + picking.move_line_ids.qty_done = 10.00 + picking.action_done() + # Cancel backorder + picking.backorder_ids.action_cancel() + res = self.env['ir.actions.report']._get_report_from_name( + 'stock.report_deliveryslip' + ).render_qweb_html(picking.ids) + self.assertNotIn("undelivered_product", str(res[0])) + + def test_picking_report_method(self): + product = self.ProductProduct.create({ + 'name': 'test01', + 'display_undelivered_in_picking': True, + 'type': 'product', + }) + product2 = self.ProductProduct.create({ + 'name': 'test02', + 'display_undelivered_in_picking': True, + 'type': 'product', + }) + self.StockQuant.create({ + 'product_id': product.id, + 'location_id': self.warehouse.lot_stock_id.id, + 'quantity': 2000, + }) + picking_form = Form(self.StockPicking) + picking_form.picking_type_id = self.picking_type_out + picking_form.partner_id = self.partner_display + with picking_form.move_ids_without_package.new() as line: + line.product_id = product + line.product_uom_qty = 50.00 + with picking_form.move_ids_without_package.new() as line: + line.product_id = product2 + line.product_uom_qty = 20.00 + picking = picking_form.save() + + picking.action_confirm() + picking.action_assign() + picking.move_line_ids.qty_done = 10.00 + picking.action_done() + # Cancel backorder + picking.backorder_ids.action_cancel() + + # Empty setting method field + picking.company_id.undelivered_product_slip_report_method = False + res = self.env['ir.actions.report']._get_report_from_name( + 'stock.report_deliveryslip' + ).render_qweb_html(picking.ids) + self.assertIn("test02", str(res[0])) + + # Print all undelivered lines, partial and completely lines + picking.company_id.undelivered_product_slip_report_method = 'all' + res = self.env['ir.actions.report']._get_report_from_name( + 'stock.report_deliveryslip' + ).render_qweb_html(picking.ids) + self.assertIn("test02", str(res[0])) + + # Print only partial undelivered lines + picking.company_id.\ + undelivered_product_slip_report_method = 'partially_undelivered' + res = self.env['ir.actions.report']._get_report_from_name( + 'stock.report_deliveryslip' + ).render_qweb_html(picking.ids) + self.assertNotIn("test02", str(res[0])) + + # Print only completely undelivered lines + picking.company_id.\ + undelivered_product_slip_report_method = 'completely_undelivered' + res = self.env['ir.actions.report']._get_report_from_name( + 'stock.report_deliveryslip' + ).render_qweb_html(picking.ids) + self.assertNotIn("partially_undelivered_line", str(res[0])) diff --git a/stock_picking_report_undelivered_product/views/product_views.xml b/stock_picking_report_undelivered_product/views/product_views.xml new file mode 100644 index 0000000..fac875c --- /dev/null +++ b/stock_picking_report_undelivered_product/views/product_views.xml @@ -0,0 +1,14 @@ + + + + + product.template + + + + + + + + + diff --git a/stock_picking_report_undelivered_product/views/report_deliveryslip.xml b/stock_picking_report_undelivered_product/views/report_deliveryslip.xml new file mode 100644 index 0000000..f9093a2 --- /dev/null +++ b/stock_picking_report_undelivered_product/views/report_deliveryslip.xml @@ -0,0 +1,53 @@ + + + + + + + + diff --git a/stock_picking_report_undelivered_product/views/res_config_settings_views.xml b/stock_picking_report_undelivered_product/views/res_config_settings_views.xml new file mode 100644 index 0000000..30dc3d0 --- /dev/null +++ b/stock_picking_report_undelivered_product/views/res_config_settings_views.xml @@ -0,0 +1,28 @@ + + + + res.config.settings.view.form.inherit.undelivered.product + res.config.settings + + +
+

Report picking undelivered products

+
+
+
+
+
+
+
+
+
+
diff --git a/stock_picking_report_undelivered_product/views/res_partner_view.xml b/stock_picking_report_undelivered_product/views/res_partner_view.xml new file mode 100644 index 0000000..123d190 --- /dev/null +++ b/stock_picking_report_undelivered_product/views/res_partner_view.xml @@ -0,0 +1,15 @@ + + + + + res.partner + form + + + + + + + + +