diff --git a/stock_picking_report_printed_flag/README.rst b/stock_picking_report_printed_flag/README.rst new file mode 100644 index 000000000..b2760b4b2 --- /dev/null +++ b/stock_picking_report_printed_flag/README.rst @@ -0,0 +1,139 @@ +================================= +Stock Picking Report Printed Flag +================================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:31680516b2e44e28ffe1d664e54dd098997743e8b5c34fcb7b9b8722a4b6ef22 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/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/17.0/stock_picking_report_printed_flag + :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-17-0/stock-logistics-reporting-17-0-stock_picking_report_printed_flag + :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=17.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module extends ``stock.picking`` to support the printed flag +mechanism provided by the ``report_printed_flag`` module. + +It enables tracking of printed warehouse documents and provides +visibility over report execution in logistics operations. + +Main features: + +- Adds ``printed`` field to ``stock.picking`` +- Tracks printed reports using the core module +- Displays printed report names per record (optional field) +- Provides direct access to printed logs +- Adds search filters: + + - Printed + - Not Printed + +- Adds group by: + + - Printed + - Printed Report Names + +- Supports multi-company configurations + +Printed report names are computed from related printed logs and +displayed as a comma-separated string. + +.. 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: + +Usage +===== + +To use this module: + +1. Install this module + +2. Configure reports in: + + *Settings > Printed Flag > Configurations* + +3. Generate a picking report (delivery slip, receipt, etc.) + +If properly configured: + +- The picking will be marked as: + + printed = True + +- Printed logs will be created (if enabled) + +- Printed report names will be computed (if enabled) + +Known issues / Roadmap +====================== + +- Improve performance for large volumes of logs +- Evaluate support for additional stock reporting flows +- Enhance usability of printed logs in warehouse operations + +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 +------- + +* Binhex Systems Solutions S.L + +Contributors +------------ + +- `Binhex Systems Solutions S.L. `__: + + - Ariel Torres + - Rolando Pérez Rebollo + +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_printed_flag/__init__.py b/stock_picking_report_printed_flag/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/stock_picking_report_printed_flag/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/stock_picking_report_printed_flag/__manifest__.py b/stock_picking_report_printed_flag/__manifest__.py new file mode 100644 index 000000000..753754232 --- /dev/null +++ b/stock_picking_report_printed_flag/__manifest__.py @@ -0,0 +1,20 @@ +{ + "name": "Stock Picking Report Printed Flag", + "summary": "Adds printed flag support to stock picking", + "version": "17.0.1.0.0", + "category": "Stock", + "license": "AGPL-3", + "author": "Binhex Systems Solutions S.L, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/stock-logistics-reporting", + "depends": [ + "stock", + "report_printed_flag", + ], + "data": [ + "views/stock_picking_views.xml", + ], + "installable": True, + "application": False, + "development_status": "Alpha", + "images": ["static/description/icon.png"], +} diff --git a/stock_picking_report_printed_flag/i18n/es.po b/stock_picking_report_printed_flag/i18n/es.po new file mode 100644 index 000000000..4c5e9fc85 --- /dev/null +++ b/stock_picking_report_printed_flag/i18n/es.po @@ -0,0 +1,77 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * report_printed_flag_stock +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2026-04-01 10:43+0000\n" +"PO-Revision-Date: 2026-04-01 10:43+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: report_printed_flag_stock +#: model:ir.model.fields,help:report_printed_flag_stock.field_stock_picking__printed_report_names +msgid "" +"Comma-separated list of printed report names, computed from related printed " +"logs. Only active if enabled in configuration." +msgstr "" +"Lista de nombres de informes impresos separados por comas, calculada a partir de los registros impresos relacionados." +" Solo se activa si está habilitada en la configuración." + +#. module: report_printed_flag_stock +#: model:ir.model.fields,help:report_printed_flag_stock.field_stock_picking__printed +msgid "" +"Indicates whether at least one configured report has been printed for this " +"record." +msgstr "Indica si el albarán ha sido impreso." + +#. module: report_printed_flag_stock +#: model_terms:ir.ui.view,arch_db:report_printed_flag_stock.view_picking_tree_printed +msgid "Logs" +msgstr "Registros" + +#. module: report_printed_flag_stock +#: model_terms:ir.ui.view,arch_db:report_printed_flag_stock.view_picking_search_printed +msgid "Not Printed" +msgstr "No Impreso" + +#. module: report_printed_flag_stock +#: model:ir.model.fields,field_description:report_printed_flag_stock.field_stock_picking__printed +#: model_terms:ir.ui.view,arch_db:report_printed_flag_stock.view_picking_search_printed +msgid "Printed" +msgstr "Impreso" + +#. module: report_printed_flag_stock +#: model:ir.model.fields,field_description:report_printed_flag_stock.field_stock_picking__printed_log_ids +msgid "Printed Log" +msgstr "Registro de Impresión" + +#. module: report_printed_flag_stock +#: model_terms:ir.ui.view,arch_db:report_printed_flag_stock.view_picking_search_printed +msgid "Printed Report Names" +msgstr "Nombres de Informes Impresos" + +#. module: report_printed_flag_stock +#: model:ir.model.fields,field_description:report_printed_flag_stock.field_stock_picking__printed_report_names +msgid "Printed Reports Names" +msgstr "Nombres de Informes Impresos" + +#. module: report_printed_flag_stock +#: model:ir.model.fields,help:report_printed_flag_stock.field_stock_picking__printed_log_ids +msgid "" +"Technical relation to printed logs using a generic reference pattern " +"(res_model, res_id). Only logs related to stock.picking are included." +msgstr "" +"Relación técnica con los registros impresos utilizando un patrón de referencia genérico " +"(res_model, res_id). Solo se incluyen los registros relacionados con account.move." + +#. module: report_printed_flag_stock +#: model:ir.model,name:report_printed_flag_stock.model_stock_picking +msgid "Transfer" +msgstr "Traslado" diff --git a/stock_picking_report_printed_flag/models/__init__.py b/stock_picking_report_printed_flag/models/__init__.py new file mode 100644 index 000000000..ae4c27227 --- /dev/null +++ b/stock_picking_report_printed_flag/models/__init__.py @@ -0,0 +1 @@ +from . import stock_picking diff --git a/stock_picking_report_printed_flag/models/stock_picking.py b/stock_picking_report_printed_flag/models/stock_picking.py new file mode 100644 index 000000000..b845f66a9 --- /dev/null +++ b/stock_picking_report_printed_flag/models/stock_picking.py @@ -0,0 +1,21 @@ +from odoo import models + + +class StockPicking(models.Model): + """ + Extension of ``stock.picking`` to integrate with the + ``report_printed_flag`` infrastructure via the mixin. + + Inheriting ``report.printed.mixin`` provides: + - ``printed``: Boolean field marking the picking as printed. + - ``printed_log_ids``: One2many relation to print logs. + - ``printed_report_names``: Computed comma-separated list of printed + report names. + - ``action_view_printed_logs()``: UI action to view logs. + + No additional fields or methods are needed — all behavior comes from + the mixin. + """ + + _name = "stock.picking" + _inherit = ["stock.picking", "report.printed.mixin"] diff --git a/stock_picking_report_printed_flag/pyproject.toml b/stock_picking_report_printed_flag/pyproject.toml new file mode 100644 index 000000000..4231d0ccc --- /dev/null +++ b/stock_picking_report_printed_flag/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/stock_picking_report_printed_flag/readme/CONFIGURATION.md b/stock_picking_report_printed_flag/readme/CONFIGURATION.md new file mode 100644 index 000000000..93dcb2994 --- /dev/null +++ b/stock_picking_report_printed_flag/readme/CONFIGURATION.md @@ -0,0 +1,9 @@ +Configuration is managed through the ``report_printed_flag`` module. + +For ``stock.picking``: + +- Select model: ``stock.picking`` +- Define report rules +- Optionally enable: + - Printed Logs + - Printed Report Names \ No newline at end of file diff --git a/stock_picking_report_printed_flag/readme/CONTRIBUTORS.md b/stock_picking_report_printed_flag/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..cfdc2ca13 --- /dev/null +++ b/stock_picking_report_printed_flag/readme/CONTRIBUTORS.md @@ -0,0 +1,3 @@ +- [Binhex Systems Solutions S.L.](https://www.binhex.cloud): + - Ariel Torres + - Rolando Pérez Rebollo diff --git a/stock_picking_report_printed_flag/readme/DESCRIPTION.md b/stock_picking_report_printed_flag/readme/DESCRIPTION.md new file mode 100644 index 000000000..777457325 --- /dev/null +++ b/stock_picking_report_printed_flag/readme/DESCRIPTION.md @@ -0,0 +1,22 @@ +This module extends ``stock.picking`` to support the printed flag +mechanism provided by the ``report_printed_flag`` module. + +It enables tracking of printed warehouse documents and provides +visibility over report execution in logistics operations. + +Main features: + +- Adds ``printed`` field to ``stock.picking`` +- Tracks printed reports using the core module +- Displays printed report names per record (optional field) +- Provides direct access to printed logs +- Adds search filters: + - Printed + - Not Printed +- Adds group by: + - Printed + - Printed Report Names +- Supports multi-company configurations + +Printed report names are computed from related printed logs and displayed +as a comma-separated string. \ No newline at end of file diff --git a/stock_picking_report_printed_flag/readme/ROADMAP.md b/stock_picking_report_printed_flag/readme/ROADMAP.md new file mode 100644 index 000000000..1cfe55daf --- /dev/null +++ b/stock_picking_report_printed_flag/readme/ROADMAP.md @@ -0,0 +1,3 @@ +* Improve performance for large volumes of logs +* Evaluate support for additional stock reporting flows +* Enhance usability of printed logs in warehouse operations \ No newline at end of file diff --git a/stock_picking_report_printed_flag/readme/USAGE.md b/stock_picking_report_printed_flag/readme/USAGE.md new file mode 100644 index 000000000..6f6a98a6d --- /dev/null +++ b/stock_picking_report_printed_flag/readme/USAGE.md @@ -0,0 +1,17 @@ +To use this module: + +1. Install this module +2. Configure reports in: + + *Settings > Printed Flag > Configurations* + +3. Generate a picking report (delivery slip, receipt, etc.) + +If properly configured: + +- The picking will be marked as: + + printed = True + +- Printed logs will be created (if enabled) +- Printed report names will be computed (if enabled) diff --git a/stock_picking_report_printed_flag/static/description/icon.png b/stock_picking_report_printed_flag/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/stock_picking_report_printed_flag/static/description/icon.png differ diff --git a/stock_picking_report_printed_flag/static/description/index.html b/stock_picking_report_printed_flag/static/description/index.html new file mode 100644 index 000000000..a722b7816 --- /dev/null +++ b/stock_picking_report_printed_flag/static/description/index.html @@ -0,0 +1,489 @@ + + + + + +Stock Picking Report Printed Flag + + + +
+

Stock Picking Report Printed Flag

+ + +

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

+

This module extends stock.picking to support the printed flag +mechanism provided by the report_printed_flag module.

+

It enables tracking of printed warehouse documents and provides +visibility over report execution in logistics operations.

+

Main features:

+
    +
  • Adds printed field to stock.picking
  • +
  • Tracks printed reports using the core module
  • +
  • Displays printed report names per record (optional field)
  • +
  • Provides direct access to printed logs
  • +
  • Adds search filters:
      +
    • Printed
    • +
    • Not Printed
    • +
    +
  • +
  • Adds group by:
      +
    • Printed
    • +
    • Printed Report Names
    • +
    +
  • +
  • Supports multi-company configurations
  • +
+

Printed report names are computed from related printed logs and +displayed as a comma-separated string.

+
+

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

+ +
+

Usage

+

To use this module:

+
    +
  1. Install this module

    +
  2. +
  3. Configure reports in:

    +

    Settings > Printed Flag > Configurations

    +
  4. +
  5. Generate a picking report (delivery slip, receipt, etc.)

    +
  6. +
+

If properly configured:

+
    +
  • The picking will be marked as:

    +

    printed = True

    +
  • +
  • Printed logs will be created (if enabled)

    +
  • +
  • Printed report names will be computed (if enabled)

    +
  • +
+
+
+

Known issues / Roadmap

+
    +
  • Improve performance for large volumes of logs
  • +
  • Evaluate support for additional stock reporting flows
  • +
  • Enhance usability of printed logs in warehouse operations
  • +
+
+
+

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

+
    +
  • Binhex Systems Solutions S.L
  • +
+
+
+

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_printed_flag/tests/__init__.py b/stock_picking_report_printed_flag/tests/__init__.py new file mode 100644 index 000000000..e16a155d5 --- /dev/null +++ b/stock_picking_report_printed_flag/tests/__init__.py @@ -0,0 +1 @@ +from . import test_stock_picking_report_printed_flag diff --git a/stock_picking_report_printed_flag/tests/test_stock_picking_report_printed_flag.py b/stock_picking_report_printed_flag/tests/test_stock_picking_report_printed_flag.py new file mode 100644 index 000000000..893fe9407 --- /dev/null +++ b/stock_picking_report_printed_flag/tests/test_stock_picking_report_printed_flag.py @@ -0,0 +1,263 @@ +from odoo.addons.base.tests.common import BaseCommon + + +class TestReportPrintedFlagStock(BaseCommon): + """ + Test suite for stock_picking_report_printed_flag. + Covers: + - printed flag behavior + - log creation + - printed report names computation + - multi-record handling + - non-configured reports + - UI actions + """ + + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.company = cls.env.company + # --------------------------- + # PICKING TYPE + # --------------------------- + cls.picking_type = cls.env.ref("stock.picking_type_out").with_company( + cls.company + ) + # --------------------------- + # LOCATIONS + # --------------------------- + cls.location_src = cls.env.ref("stock.stock_location_stock") + cls.location_dest = cls.env.ref("stock.stock_location_customers") + # --------------------------- + # PARTNER + # --------------------------- + cls.partner = cls.env["res.partner"].create( + { + "name": "Test Partner", + } + ) + # --------------------------- + # PICKING + # --------------------------- + cls.picking = cls.env["stock.picking"].create( + { + "partner_id": cls.partner.id, + "picking_type_id": cls.picking_type.id, + "location_id": cls.location_src.id, + "location_dest_id": cls.location_dest.id, + "company_id": cls.company.id, + } + ) + # --------------------------- + # QWEB TEMPLATE + # --------------------------- + cls.env["ir.ui.view"].create( + { + "name": "test_stock_report_template", + "type": "qweb", + "key": "stock_picking_report_printed_flag.test_template", + "arch": """ + + +
+ +
+
+
+ """, + } + ) + # --------------------------- + # REPORT + # --------------------------- + cls.report = cls.env["ir.actions.report"].create( + { + "name": "Test Picking Report", + "model": "stock.picking", + "report_type": "qweb-pdf", + "report_name": "stock_picking_report_printed_flag.test_template", + } + ) + # --------------------------- + # CONFIG + # --------------------------- + cls.config = cls.env["report.printed.config"].create( + { + "name": "Stock Config", + "model_id": cls.env["ir.model"]._get("stock.picking").id, + "company_id": cls.company.id, + "report_printed_log_active": True, + "report_printed_names_active": True, + "line_ids": [ + ( + 0, + 0, + { + "report_id": cls.report.id, + }, + ) + ], + } + ) + + # --------------------------- + # TESTS + # --------------------------- + def test_printed_flag(self): + """Printing should mark picking as printed""" + self.assertFalse(self.picking.printed) + self.report._render_qweb_pdf( + self.report.report_name, + self.picking.ids, + ) + self.picking.invalidate_recordset() + self.assertTrue(self.picking.printed) + + def test_log_created(self): + """Printing should create a log entry""" + self.env["report.printed.log"].search([]).unlink() + self.report._render_qweb_pdf( + self.report.report_name, + self.picking.ids, + ) + logs = self.env["report.printed.log"].search( + [ + ("res_model", "=", "stock.picking"), + ("res_id", "=", self.picking.id), + ] + ) + self.assertTrue(logs) + + def test_printed_report_names(self): + """Printed report names should be computed""" + self.report._render_qweb_pdf( + self.report.report_name, + self.picking.ids, + ) + self.picking.invalidate_recordset() + self.assertTrue(self.picking.printed_report_names) + self.assertIn("Test Picking Report", self.picking.printed_report_names) + + def test_multiple_records(self): + """Batch printing should mark all pickings""" + picking2 = self.picking.copy() + self.report._render_qweb_pdf( + self.report.report_name, + (self.picking | picking2).ids, + ) + self.picking.invalidate_recordset() + picking2.invalidate_recordset() + self.assertTrue(self.picking.printed) + self.assertTrue(picking2.printed) + + def test_multiple_logs(self): + """Multiple prints should create multiple logs""" + self.env["report.printed.log"].search([]).unlink() + self.report._render_qweb_pdf( + self.report.report_name, + self.picking.ids, + ) + self.report._render_qweb_pdf( + self.report.report_name, + self.picking.ids, + ) + logs = self.env["report.printed.log"].search( + [ + ("res_model", "=", "stock.picking"), + ("res_id", "=", self.picking.id), + ] + ) + self.assertEqual( + len(logs), + 2, + "Each report execution should create a separate log entry.", + ) + + def test_report_not_configured(self): + """Non-configured report should not mark printed or create logs.""" + other_report = self.env["ir.actions.report"].create( + { + "name": "Other Report", + "model": "stock.picking", + "report_type": "qweb-pdf", + "report_name": ("stock_picking_report_printed_flag.test_template"), + } + ) + self.env["report.printed.log"].search([]).unlink() + self.picking.write({"printed": False}) + other_report._render_qweb_pdf( + other_report.report_name, + self.picking.ids, + ) + self.picking.invalidate_recordset() + logs = self.env["report.printed.log"].search( + [ + ("res_model", "=", "stock.picking"), + ("res_id", "=", self.picking.id), + ] + ) + self.assertFalse(self.picking.printed) + self.assertFalse(logs) + + def test_action_view_printed_logs(self): + """UI action should return correct domain.""" + action = self.picking.action_view_printed_logs() + self.assertEqual(action["type"], "ir.actions.act_window") + self.assertEqual(action["res_model"], "report.printed.log") + self.assertEqual(action["view_mode"], "tree") + self.assertIn( + ("res_model", "=", "stock.picking"), + action["domain"], + ) + self.assertIn( + ("res_id", "=", self.picking.id), + action["domain"], + ) + + def test_stock_picking_has_printed_mixin_fields(self): + """Stock pickings should expose fields provided by the printed mixin.""" + self.assertIn("printed", self.picking._fields) + self.assertIn("printed_log_ids", self.picking._fields) + self.assertIn("printed_report_names", self.picking._fields) + + def test_log_values(self): + """Printed log should contain stock picking metadata.""" + self.env["report.printed.log"].search([]).unlink() + self.report._render_qweb_pdf( + self.report.report_name, + self.picking.ids, + ) + log = self.env["report.printed.log"].search( + [ + ("res_model", "=", "stock.picking"), + ("res_id", "=", self.picking.id), + ], + limit=1, + ) + self.assertTrue(log) + self.assertEqual(log.res_model, "stock.picking") + self.assertEqual(log.res_id, self.picking.id) + self.assertEqual(log.report_id, self.report) + self.assertEqual(log.company_id, self.company) + self.assertEqual(log.user_id, self.env.user) + + def test_logs_disabled(self): + """Logs should not be created when disabled in configuration.""" + self.config.write( + { + "report_printed_log_active": False, + "report_printed_names_active": False, + } + ) + self.env["report.printed.log"].search([]).unlink() + self.report._render_qweb_pdf( + self.report.report_name, + self.picking.ids, + ) + logs = self.env["report.printed.log"].search( + [ + ("res_model", "=", "stock.picking"), + ("res_id", "=", self.picking.id), + ] + ) + self.assertFalse(logs) diff --git a/stock_picking_report_printed_flag/views/stock_picking_views.xml b/stock_picking_report_printed_flag/views/stock_picking_views.xml new file mode 100644 index 000000000..550ed75e9 --- /dev/null +++ b/stock_picking_report_printed_flag/views/stock_picking_views.xml @@ -0,0 +1,57 @@ + + + + + stock.picking.tree.printed + stock.picking + + + + + +