diff --git a/setup/stock_picking_report_summary/odoo/addons/stock_picking_report_summary b/setup/stock_picking_report_summary/odoo/addons/stock_picking_report_summary new file mode 120000 index 000000000..f33ae5bbe --- /dev/null +++ b/setup/stock_picking_report_summary/odoo/addons/stock_picking_report_summary @@ -0,0 +1 @@ +../../../../stock_picking_report_summary \ No newline at end of file diff --git a/setup/stock_picking_report_summary/setup.py b/setup/stock_picking_report_summary/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/stock_picking_report_summary/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/stock_picking_report_summary/README.rst b/stock_picking_report_summary/README.rst new file mode 100644 index 000000000..8163a6071 --- /dev/null +++ b/stock_picking_report_summary/README.rst @@ -0,0 +1,113 @@ +============================ +Stock Picking Report Summary +============================ + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:55007a3115945f634dc0c35e3cc2e359b6ecb6f2ad8145726e87a3411af3c028 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/16.0/stock_picking_report_summary + :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-16-0/stock-logistics-reporting-16-0-stock_picking_report_summary + :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=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Select several Pickings to print a PDF summary with two sheets : + +* Products Summary (where the total sum is calculated for each product) + +* Detail Part (each delivery is detailed product by product, with lines at 0 printed in grey) + +You can choose to print standard prices or not (can be useful to check some +values when you prepare your pickings). + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +To use this module, you need to + +* Go to Inventory + +* Choose a Operation + +* Select any pickings and click on 'Action' / 'Picking Summary' + +.. figure:: https://raw.githubusercontent.com/OCA/stock-logistics-reporting/16.0/stock_picking_report_summary/static/description/new_print_action.png + +* Choose your options + +.. figure:: https://raw.githubusercontent.com/OCA/stock-logistics-reporting/16.0/stock_picking_report_summary/static/description/wizard.png + +.. figure:: https://raw.githubusercontent.com/OCA/stock-logistics-reporting/16.0/stock_picking_report_summary/static/description/pdf_report.png + +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 +~~~~~~~ + +* Grap + +Contributors +~~~~~~~~~~~~ + +* Quentin DUPONT (quentin.dupont@grap.coop) + +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-quentinDupont| image:: https://github.com/quentinDupont.png?size=40px + :target: https://github.com/quentinDupont + :alt: quentinDupont +.. |maintainer-legalsylvain| image:: https://github.com/legalsylvain.png?size=40px + :target: https://github.com/legalsylvain + :alt: legalsylvain + +Current `maintainers `__: + +|maintainer-quentinDupont| |maintainer-legalsylvain| + +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_summary/__init__.py b/stock_picking_report_summary/__init__.py new file mode 100644 index 000000000..5cb1c4914 --- /dev/null +++ b/stock_picking_report_summary/__init__.py @@ -0,0 +1 @@ +from . import wizards diff --git a/stock_picking_report_summary/__manifest__.py b/stock_picking_report_summary/__manifest__.py new file mode 100644 index 000000000..d6e3eac0f --- /dev/null +++ b/stock_picking_report_summary/__manifest__.py @@ -0,0 +1,24 @@ +# Copyright (C) 2020 - Today: GRAP (http://www.grap.coop) +# @author: Quentin DUPONT (quentin.dupont@grap.coop) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +{ + "name": "Stock Picking Report Summary", + "summary": "Stock Picking Report Summary", + "version": "16.0.1.0.0", + "author": "Grap, " "Odoo Community Association (OCA)", + "maintainers": ["quentinDupont", "legalsylvain"], + "website": "https://github.com/OCA/stock-logistics-reporting", + "category": "Warehouse Management", + "license": "AGPL-3", + "depends": [ + "stock", + ], + "data": [ + "security/ir.model.access.csv", + "reports/report_print_picking_summary.xml", + "reports/report_print_picking_summary_template.xml", + "wizards/view_picking_summary_wizard.xml", + ], + "installable": True, +} diff --git a/stock_picking_report_summary/i18n/fr.po b/stock_picking_report_summary/i18n/fr.po new file mode 100644 index 000000000..df387e864 --- /dev/null +++ b/stock_picking_report_summary/i18n/fr.po @@ -0,0 +1,226 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_picking_report_summary +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-03-15 14:52+0000\n" +"PO-Revision-Date: 2024-03-15 14:52+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_summary +#: model_terms:ir.ui.view,arch_db:stock_picking_report_summary.view_picking_summary_wizard_form +msgid "Cancel" +msgstr "Annuler" + +#. module: stock_picking_report_summary +#: model_terms:ir.ui.view,arch_db:stock_picking_report_summary.picking_summary +msgid "Category" +msgstr "Catégorie" + +#. module: stock_picking_report_summary +#: model:ir.model.fields,field_description:stock_picking_report_summary.field_picking_summary_wizard_product__standard_price +msgid "Cost" +msgstr "Coût" + +#. module: stock_picking_report_summary +#: model:ir.model.fields,field_description:stock_picking_report_summary.field_picking_summary_wizard__create_uid +#: model:ir.model.fields,field_description:stock_picking_report_summary.field_picking_summary_wizard_picking__create_uid +#: model:ir.model.fields,field_description:stock_picking_report_summary.field_picking_summary_wizard_product__create_uid +msgid "Created by" +msgstr "Créé par" + +#. module: stock_picking_report_summary +#: model:ir.model.fields,field_description:stock_picking_report_summary.field_picking_summary_wizard__create_date +#: model:ir.model.fields,field_description:stock_picking_report_summary.field_picking_summary_wizard_picking__create_date +#: model:ir.model.fields,field_description:stock_picking_report_summary.field_picking_summary_wizard_product__create_date +msgid "Created on" +msgstr "Créé le" + +#. module: stock_picking_report_summary +#: model:ir.model.fields,field_description:stock_picking_report_summary.field_picking_summary_wizard__display_name +#: model:ir.model.fields,field_description:stock_picking_report_summary.field_picking_summary_wizard_picking__display_name +#: model:ir.model.fields,field_description:stock_picking_report_summary.field_picking_summary_wizard_product__display_name +msgid "Display Name" +msgstr "Nom affiché" + +#. module: stock_picking_report_summary +#: model_terms:ir.ui.view,arch_db:stock_picking_report_summary.view_picking_summary_wizard_form +msgid "For Pickings details" +msgstr "Pour les détails des livraisons" + +#. module: stock_picking_report_summary +#: model_terms:ir.ui.view,arch_db:stock_picking_report_summary.view_picking_summary_wizard_form +msgid "For Summary" +msgstr "Pour le résumé" + +#. module: stock_picking_report_summary +#: model_terms:ir.ui.view,arch_db:stock_picking_report_summary.view_picking_summary_wizard_form +msgid "General informations" +msgstr "Informations générales" + +#. module: stock_picking_report_summary +#: model:ir.model.fields,field_description:stock_picking_report_summary.field_picking_summary_wizard__id +#: model:ir.model.fields,field_description:stock_picking_report_summary.field_picking_summary_wizard_picking__id +#: model:ir.model.fields,field_description:stock_picking_report_summary.field_picking_summary_wizard_product__id +msgid "ID" +msgstr "" + +#. module: stock_picking_report_summary +#: model:ir.model.fields,help:stock_picking_report_summary.field_picking_summary_wizard_product__standard_price +msgid "" +"In Standard Price & AVCO: value of the product (automatically computed in AVCO).\n" +" In FIFO: value of the next unit that will leave the stock (automatically computed).\n" +" Used to value the product when the purchase cost is not known (e.g. inventory adjustment).\n" +" Used to compute margins on sale orders." +msgstr "" +"Également utilisé comme prix de base pour les listes. Exprimé dans l'unité " +"de mesure par défaut du produit." + +#. module: stock_picking_report_summary +#: model:ir.model.fields,field_description:stock_picking_report_summary.field_picking_summary_wizard____last_update +#: model:ir.model.fields,field_description:stock_picking_report_summary.field_picking_summary_wizard_picking____last_update +#: model:ir.model.fields,field_description:stock_picking_report_summary.field_picking_summary_wizard_product____last_update +msgid "Last Modified on" +msgstr "Dernière modification le" + +#. module: stock_picking_report_summary +#: model:ir.model.fields,field_description:stock_picking_report_summary.field_picking_summary_wizard__write_uid +#: model:ir.model.fields,field_description:stock_picking_report_summary.field_picking_summary_wizard_picking__write_uid +#: model:ir.model.fields,field_description:stock_picking_report_summary.field_picking_summary_wizard_product__write_uid +msgid "Last Updated by" +msgstr "Dernière mise à jour par" + +#. module: stock_picking_report_summary +#: model:ir.model.fields,field_description:stock_picking_report_summary.field_picking_summary_wizard__write_date +#: model:ir.model.fields,field_description:stock_picking_report_summary.field_picking_summary_wizard_picking__write_date +#: model:ir.model.fields,field_description:stock_picking_report_summary.field_picking_summary_wizard_product__write_date +msgid "Last Updated on" +msgstr "Dernière mise à jour le" + +#. module: stock_picking_report_summary +#: model:ir.model.fields,field_description:stock_picking_report_summary.field_picking_summary_wizard__picking_line_qty +msgid "Number of Selected Picking" +msgstr "Quantité sélectionnée" + +#. module: stock_picking_report_summary +#: model:ir.model.fields,field_description:stock_picking_report_summary.field_picking_summary_wizard_picking__picking_id +msgid "Picking" +msgstr "Livraison" + +#. module: stock_picking_report_summary +#: model:ir.model.fields,field_description:stock_picking_report_summary.field_picking_summary_wizard__picking_line_ids +msgid "Picking Line" +msgstr "Ligne de bon de livraison" + +#. module: stock_picking_report_summary +#: model:ir.actions.act_window,name:stock_picking_report_summary.action_picking_summary +#: model:ir.actions.report,name:stock_picking_report_summary.report_picking_summary +msgid "Picking Summary" +msgstr "Résumé des livraisons" + +#. module: stock_picking_report_summary +#: model:ir.model,name:stock_picking_report_summary.model_picking_summary_wizard +msgid "Picking Summary Wizard" +msgstr "" + +#. module: stock_picking_report_summary +#: model:ir.model,name:stock_picking_report_summary.model_picking_summary_wizard_picking +msgid "Picking Summary Wizard Picking" +msgstr "" + +#. module: stock_picking_report_summary +#: model:ir.model,name:stock_picking_report_summary.model_picking_summary_wizard_product +msgid "Picking Summary Wizard Product" +msgstr "" + +#. module: stock_picking_report_summary +#: model_terms:ir.ui.view,arch_db:stock_picking_report_summary.picking_summary +msgid "Pickings Details" +msgstr "Détails des livraisons" + +#. module: stock_picking_report_summary +#: model_terms:ir.ui.view,arch_db:stock_picking_report_summary.view_picking_summary_wizard_form +msgid "Print PDF" +msgstr "Imprimer le PDF" + +#. module: stock_picking_report_summary +#: model:ir.model.fields,field_description:stock_picking_report_summary.field_picking_summary_wizard__print_details +msgid "Print Picking Details" +msgstr "Imprimer le détail des livraisons" + +#. module: stock_picking_report_summary +#: model:ir.model.fields,field_description:stock_picking_report_summary.field_picking_summary_wizard__print_prices +msgid "Print Standard Prices" +msgstr "Imprimer les prix de revient" + +#. module: stock_picking_report_summary +#: model:ir.model.fields,field_description:stock_picking_report_summary.field_picking_summary_wizard__print_summary +msgid "Print Summary" +msgstr "Imprimer le résumé" + +#. module: stock_picking_report_summary +#: model:ir.model.fields,field_description:stock_picking_report_summary.field_picking_summary_wizard__print_unit_in_list +msgid "Print Units" +msgstr "Imprimer les unités de mesure" + +#. module: stock_picking_report_summary +#: model:ir.model.fields,field_description:stock_picking_report_summary.field_picking_summary_wizard_product__product_id +#: model_terms:ir.ui.view,arch_db:stock_picking_report_summary.picking_summary +msgid "Product" +msgstr "Article" + +#. module: stock_picking_report_summary +#: model:ir.model.fields,field_description:stock_picking_report_summary.field_picking_summary_wizard__product_line_ids +msgid "Product Line" +msgstr "Ligne de produit" + +#. module: stock_picking_report_summary +#: model_terms:ir.ui.view,arch_db:stock_picking_report_summary.picking_summary +msgid "Products Summary" +msgstr "Résumé des bons de livraison" + +#. module: stock_picking_report_summary +#: model_terms:ir.ui.view,arch_db:stock_picking_report_summary.picking_summary +msgid "Quantity" +msgstr "Quantité" + +#. module: stock_picking_report_summary +#: model:ir.model.fields,field_description:stock_picking_report_summary.field_picking_summary_wizard_product__quantity_total +msgid "Quantity Total" +msgstr "Quantité totale" + +#. module: stock_picking_report_summary +#: model:ir.model.fields,field_description:stock_picking_report_summary.field_picking_summary_wizard__standard_price_total +#: model:ir.model.fields,field_description:stock_picking_report_summary.field_picking_summary_wizard_product__standard_price_total +#: model_terms:ir.ui.view,arch_db:stock_picking_report_summary.picking_summary +msgid "Standard Price Total" +msgstr "Total prix de vente" + +#. module: stock_picking_report_summary +#: model_terms:ir.ui.view,arch_db:stock_picking_report_summary.picking_summary +msgid "Standard Unit Price" +msgstr "Coût unitaire" + +#. module: stock_picking_report_summary +#: model_terms:ir.ui.view,arch_db:stock_picking_report_summary.picking_summary +msgid "Total price" +msgstr "Prix total" + +#. module: stock_picking_report_summary +#: model_terms:ir.ui.view,arch_db:stock_picking_report_summary.picking_summary +msgid "Unit" +msgstr "Unité" + +#. module: stock_picking_report_summary +#: model:ir.model.fields,field_description:stock_picking_report_summary.field_picking_summary_wizard_picking__wizard_id +#: model:ir.model.fields,field_description:stock_picking_report_summary.field_picking_summary_wizard_product__wizard_id +msgid "Wizard" +msgstr "Assistant" diff --git a/stock_picking_report_summary/readme/CONTRIBUTORS.rst b/stock_picking_report_summary/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..a5cc8a81f --- /dev/null +++ b/stock_picking_report_summary/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Quentin DUPONT (quentin.dupont@grap.coop) diff --git a/stock_picking_report_summary/readme/DESCRIPTION.rst b/stock_picking_report_summary/readme/DESCRIPTION.rst new file mode 100644 index 000000000..e4e0dfe00 --- /dev/null +++ b/stock_picking_report_summary/readme/DESCRIPTION.rst @@ -0,0 +1,8 @@ +Select several Pickings to print a PDF summary with two sheets : + +* Products Summary (where the total sum is calculated for each product) + +* Detail Part (each delivery is detailed product by product, with lines at 0 printed in grey) + +You can choose to print standard prices or not (can be useful to check some +values when you prepare your pickings). diff --git a/stock_picking_report_summary/readme/USAGE.rst b/stock_picking_report_summary/readme/USAGE.rst new file mode 100644 index 000000000..d691a8281 --- /dev/null +++ b/stock_picking_report_summary/readme/USAGE.rst @@ -0,0 +1,15 @@ +To use this module, you need to + +* Go to Inventory + +* Choose a Operation + +* Select any pickings and click on 'Action' / 'Picking Summary' + +.. figure:: ../static/description/new_print_action.png + +* Choose your options + +.. figure:: ../static/description/wizard.png + +.. figure:: ../static/description/pdf_report.png diff --git a/stock_picking_report_summary/reports/report_print_picking_summary.xml b/stock_picking_report_summary/reports/report_print_picking_summary.xml new file mode 100644 index 000000000..b9413278e --- /dev/null +++ b/stock_picking_report_summary/reports/report_print_picking_summary.xml @@ -0,0 +1,16 @@ + + + + Picking Summary + picking.summary.wizard + qweb-pdf + stock_picking_report_summary.picking_summary + stock_picking_report_summary.picking_summary + + + report + + diff --git a/stock_picking_report_summary/reports/report_print_picking_summary_template.xml b/stock_picking_report_summary/reports/report_print_picking_summary_template.xml new file mode 100644 index 000000000..5268e0bd2 --- /dev/null +++ b/stock_picking_report_summary/reports/report_print_picking_summary_template.xml @@ -0,0 +1,145 @@ + + + + + diff --git a/stock_picking_report_summary/security/ir.model.access.csv b/stock_picking_report_summary/security/ir.model.access.csv new file mode 100644 index 000000000..c206d8840 --- /dev/null +++ b/stock_picking_report_summary/security/ir.model.access.csv @@ -0,0 +1,4 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +picking_summary_wizard,picking_summary_wizard,stock_picking_report_summary.model_picking_summary_wizard,stock.group_stock_user,1,1,1,0 +picking_summary_wizard_product,picking_summary_wizard_product,stock_picking_report_summary.model_picking_summary_wizard_product,stock.group_stock_user,1,1,1,0 +picking_summary_wizard_picking,picking_summary_wizard_picking,stock_picking_report_summary.model_picking_summary_wizard_picking,stock.group_stock_user,1,1,1,0 diff --git a/stock_picking_report_summary/static/description/icon.png b/stock_picking_report_summary/static/description/icon.png new file mode 100644 index 000000000..7630b14a4 Binary files /dev/null and b/stock_picking_report_summary/static/description/icon.png differ diff --git a/stock_picking_report_summary/static/description/index.html b/stock_picking_report_summary/static/description/index.html new file mode 100644 index 000000000..7f5f4cd68 --- /dev/null +++ b/stock_picking_report_summary/static/description/index.html @@ -0,0 +1,451 @@ + + + + + + +Stock Picking Report Summary + + + +
+

Stock Picking Report Summary

+ + +

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

+

Select several Pickings to print a PDF summary with two sheets :

+
    +
  • Products Summary (where the total sum is calculated for each product)
  • +
  • Detail Part (each delivery is detailed product by product, with lines at 0 printed in grey)
  • +
+

You can choose to print standard prices or not (can be useful to check some +values when you prepare your pickings).

+

Table of contents

+ +
+

Usage

+

To use this module, you need to

+
    +
  • Go to Inventory
  • +
  • Choose a Operation
  • +
  • Select any pickings and click on ‘Action’ / ‘Picking Summary’
  • +
+
+https://raw.githubusercontent.com/OCA/stock-logistics-reporting/16.0/stock_picking_report_summary/static/description/new_print_action.png +
+
    +
  • Choose your options
  • +
+
+https://raw.githubusercontent.com/OCA/stock-logistics-reporting/16.0/stock_picking_report_summary/static/description/wizard.png +
+
+https://raw.githubusercontent.com/OCA/stock-logistics-reporting/16.0/stock_picking_report_summary/static/description/pdf_report.png +
+
+
+

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

+
    +
  • Grap
  • +
+
+
+

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:

+

quentinDupont legalsylvain

+

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_summary/static/description/new_print_action.png b/stock_picking_report_summary/static/description/new_print_action.png new file mode 100644 index 000000000..c8c1f8ff5 Binary files /dev/null and b/stock_picking_report_summary/static/description/new_print_action.png differ diff --git a/stock_picking_report_summary/static/description/pdf_report.png b/stock_picking_report_summary/static/description/pdf_report.png new file mode 100644 index 000000000..10e6412f5 Binary files /dev/null and b/stock_picking_report_summary/static/description/pdf_report.png differ diff --git a/stock_picking_report_summary/static/description/wizard.png b/stock_picking_report_summary/static/description/wizard.png new file mode 100644 index 000000000..0eb3989bb Binary files /dev/null and b/stock_picking_report_summary/static/description/wizard.png differ diff --git a/stock_picking_report_summary/tests/__init__.py b/stock_picking_report_summary/tests/__init__.py new file mode 100644 index 000000000..d9b96c4fa --- /dev/null +++ b/stock_picking_report_summary/tests/__init__.py @@ -0,0 +1 @@ +from . import test_module diff --git a/stock_picking_report_summary/tests/test_module.py b/stock_picking_report_summary/tests/test_module.py new file mode 100644 index 000000000..eddbed2b0 --- /dev/null +++ b/stock_picking_report_summary/tests/test_module.py @@ -0,0 +1,40 @@ +# Copyright (C) 2022 - Today: GRAP (http://www.grap.coop) +# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo.tests.common import TransactionCase + + +class TestModule(TransactionCase): + def setUp(self): + super().setUp() + self.PickingReportWizard = self.env["picking.summary.wizard"] + self.StockPicking = self.env["stock.picking"] + self.outPickingType = self.env.ref("stock.picking_type_out") + self.ir_actions_report = self.env["ir.actions.report"] + self.report_name = "stock_picking_report_summary.report_picking_summary" + + def test_01_wizard(self): + pickings = self.StockPicking.search( + [ + ("picking_type_id", "=", self.outPickingType.id), + ] + ) + + wizard = self.PickingReportWizard.with_context( + active_model="stock.picking", + active_ids=pickings.ids, + ).create({}) + + # Test fields Compute + sum_th = sum(wizard.mapped("product_line_ids.standard_price_total")) + wizard._compute_standard_price_total() + self.assertEqual(sum_th, wizard.standard_price_total) + + # Test PDF render + custom_note = "La Rabia Del Pueblo - Keny Arkana" + pickings[0].note = custom_note + res = str( + self.ir_actions_report._render_qweb_html(self.report_name, wizard.ids)[0] + ) + self.assertIn(custom_note, res) diff --git a/stock_picking_report_summary/wizards/__init__.py b/stock_picking_report_summary/wizards/__init__.py new file mode 100644 index 000000000..f8a989551 --- /dev/null +++ b/stock_picking_report_summary/wizards/__init__.py @@ -0,0 +1,3 @@ +from . import picking_summary_wizard +from . import picking_summary_wizard_picking +from . import picking_summary_wizard_product diff --git a/stock_picking_report_summary/wizards/picking_summary_wizard.py b/stock_picking_report_summary/wizards/picking_summary_wizard.py new file mode 100644 index 000000000..834efe98a --- /dev/null +++ b/stock_picking_report_summary/wizards/picking_summary_wizard.py @@ -0,0 +1,107 @@ +# Copyright (C) 2015 - Today: GRAP (http://www.grap.coop) +# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class PickingSummaryWizard(models.TransientModel): + _name = "picking.summary.wizard" + _description = "Picking Summary Wizard" + + # Columns Section + print_summary = fields.Boolean(default=True) + + print_details = fields.Boolean(string="Print Picking Details", default=True) + + print_unit_in_list = fields.Boolean(string="Print Units", default=True) + + print_prices = fields.Boolean(string="Print Standard Prices", default=False) + + product_line_ids = fields.One2many( + comodel_name="picking.summary.wizard.product", + inverse_name="wizard_id", + default=lambda self: self._default_product_line_ids(), + ) + + standard_price_total = fields.Float( + compute="_compute_standard_price_total", + digits="Product Price", + ) + + picking_line_ids = fields.One2many( + comodel_name="picking.summary.wizard.picking", + inverse_name="wizard_id", + default=lambda self: self._default_picking_line_ids(), + ) + + picking_line_qty = fields.Integer( + string="Number of Selected Picking", + readonly=True, + default=lambda self: self._default_picking_line_qty(), + ) + + # Default Section + def _default_picking_line_qty(self): + return len(self._context.get("active_ids", [])) + + def _default_picking_line_ids(self): + picking_obj = self.env["stock.picking"] + res = [] + picking_ids = self._context.get("active_ids", []) + for picking in picking_obj.browse(picking_ids): + res.append( + ( + 0, + 0, + { + "picking_id": picking.id, + }, + ) + ) + return res + + def _default_product_line_ids(self): + picking_obj = self.env["stock.picking"] + res = [] + product_lines = {} + picking_ids = self.env.context.get("active_ids", []) + # move.product_qty is real quantity with referent uom + for picking in picking_obj.browse(picking_ids): + for move in picking.move_ids: + if move.product_id.id not in product_lines.keys(): + product_lines[move.product_id.id] = { + "name": move.product_id.name, + "categ": move.product_id.categ_id.name.capitalize(), + "qty": move.product_qty, + } + else: + old_qty = product_lines[move.product_id.id]["qty"] + product_lines[move.product_id.id] = { + "name": move.product_id.name, + "categ": move.product_id.categ_id.name.capitalize(), + "qty": old_qty + move.product_qty, + } + # Arranged in alphabetical order for category then product name + product_lines_sorted = sorted( + product_lines.items(), key=lambda x: (x[1]["categ"], x[1]["name"]) + ) + for product_id, name_qty in product_lines_sorted: + res.append( + ( + 0, + 0, + { + "product_id": product_id, + "quantity_total": name_qty["qty"], + }, + ) + ) + return res + + # Compute Section + def _compute_standard_price_total(self): + self.ensure_one() + self.standard_price_total = sum( + self.mapped("product_line_ids.standard_price_total") + ) diff --git a/stock_picking_report_summary/wizards/picking_summary_wizard_picking.py b/stock_picking_report_summary/wizards/picking_summary_wizard_picking.py new file mode 100644 index 000000000..4cb67dc83 --- /dev/null +++ b/stock_picking_report_summary/wizards/picking_summary_wizard_picking.py @@ -0,0 +1,14 @@ +# Copyright (C) 2015 - Today: GRAP (http://www.grap.coop) +# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class PickingSummaryWizardPicking(models.TransientModel): + _name = "picking.summary.wizard.picking" + _description = "Picking Summary Wizard Picking" + + wizard_id = fields.Many2one(comodel_name="picking.summary.wizard") + + picking_id = fields.Many2one(comodel_name="stock.picking") diff --git a/stock_picking_report_summary/wizards/picking_summary_wizard_product.py b/stock_picking_report_summary/wizards/picking_summary_wizard_product.py new file mode 100644 index 000000000..f9d91fe93 --- /dev/null +++ b/stock_picking_report_summary/wizards/picking_summary_wizard_product.py @@ -0,0 +1,31 @@ +# Copyright (C) 2015 - Today: GRAP (http://www.grap.coop) +# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class PickingSummaryWizardProduct(models.TransientModel): + _name = "picking.summary.wizard.product" + _description = "Picking Summary Wizard Product" + + wizard_id = fields.Many2one(comodel_name="picking.summary.wizard") + + product_id = fields.Many2one(comodel_name="product.product") + + quantity_total = fields.Float() + + standard_price = fields.Float( + related="product_id.standard_price", digits="Product Price" + ) + + standard_price_total = fields.Float( + compute="_compute_standard_price_total", + digits="Product Price", + ) + + def _compute_standard_price_total(self): + for line in self: + line.standard_price_total = ( + line.product_id.standard_price * line.quantity_total + ) diff --git a/stock_picking_report_summary/wizards/view_picking_summary_wizard.xml b/stock_picking_report_summary/wizards/view_picking_summary_wizard.xml new file mode 100644 index 000000000..febebe849 --- /dev/null +++ b/stock_picking_report_summary/wizards/view_picking_summary_wizard.xml @@ -0,0 +1,56 @@ + + + + + + picking.summary.wizard + +
+ + + + + + + + + + + + + +
+
+
+
+
+ + + Picking Summary + picking.summary.wizard + form + new + + report + + +