diff --git a/report_display_name_in_footer/README.rst b/report_display_name_in_footer/README.rst new file mode 100644 index 0000000000..20348e8e15 --- /dev/null +++ b/report_display_name_in_footer/README.rst @@ -0,0 +1,160 @@ +============================= +Report Display Name in Footer +============================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:377040a7fd82c8e62b3a5e6c20ce1456bc7fe3976f52e826b2f197c64c3d5487 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-LGPL--3-blue.png + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github + :target: https://github.com/OCA/reporting-engine/tree/16.0/report_display_name_in_footer + :alt: OCA/reporting-engine +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/reporting-engine-16-0/reporting-engine-16-0-report_display_name_in_footer + :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/reporting-engine&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module extends the pagination functionality in reports to display +the name of the document on each page of PDFs, allowing you to know +which document each page belongs to and in what order they should +appear. + +Pagination will appear on the left side and document name on the right +side of the footer. + +.. 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 +=================== + +Printing the name of the document on footer is only allowed by default +to invoices by setting ``account.display_name_in_footer_models`` to +True. + +This module was developed because there is no way to print other +document names on each page of reports. + +It will be useful for you if you want to print the name of the document +in the footer pages to quickly know what page belongs to what document. + +Also you can define what documents will have the document name in its +footer. + +Configuration +============= + +To configure this module, you need to: + +1. Go to System parameters and create or edit + ``report.display_name_in_footer_models`` parameter. + +2. Add desired model names separated by comma. + + - If you want to print name on all reports, just write 'all' on the + value. + - If you want to exclude certain models, add '-' before model name. + +3. Examples: + + - Only few models: sale.order,purchase.order,stock.picking + - All models: all + - All models except two: all,-sale.order,-purchase.order + +4. The field printed in the report will be *name* for any type of + document. If your document doesn't have this field, please exclude + from the list with '-' and the name of the model. + +5. Compatible document layout: + + - Light + - Boxed + - Striped + +6. Compatible report types: + + - PDF + +Usage +===== + +To use this module, you need to: + +1. Go to System Parameters. +2. Add your desired models or use 'all' to show document name on all + type of documents. +3. Print a report for you desired model. +4. Check Footer to see document name. + +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 +------------ + +- Eduardo de Miguel (`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-Shide| image:: https://github.com/Shide.png?size=40px + :target: https://github.com/Shide + :alt: Shide +.. |maintainer-rafaelbn| image:: https://github.com/rafaelbn.png?size=40px + :target: https://github.com/rafaelbn + :alt: rafaelbn + +Current `maintainers `__: + +|maintainer-Shide| |maintainer-rafaelbn| + +This module is part of the `OCA/reporting-engine `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/report_display_name_in_footer/__init__.py b/report_display_name_in_footer/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/report_display_name_in_footer/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/report_display_name_in_footer/__manifest__.py b/report_display_name_in_footer/__manifest__.py new file mode 100644 index 0000000000..89a7413008 --- /dev/null +++ b/report_display_name_in_footer/__manifest__.py @@ -0,0 +1,23 @@ +# Copyright 2024 Moduon Team S.L. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0) + +{ + "name": "Report Display Name in Footer", + "summary": "Show document name in report footer", + "version": "16.0.1.0.0", + "development_status": "Alpha", + "category": "Tools", + "website": "https://github.com/OCA/reporting-engine", + "author": "Moduon, Odoo Community Association (OCA)", + "maintainers": ["Shide", "rafaelbn"], + "license": "LGPL-3", + "application": False, + "installable": True, + "depends": [ + "web", + ], + "data": [ + "data/report_data.xml", + "views/report_templates.xml", + ], +} diff --git a/report_display_name_in_footer/data/report_data.xml b/report_display_name_in_footer/data/report_data.xml new file mode 100644 index 0000000000..915827055e --- /dev/null +++ b/report_display_name_in_footer/data/report_data.xml @@ -0,0 +1,7 @@ + + + + report.display_name_in_footer_models + all + + diff --git a/report_display_name_in_footer/models/__init__.py b/report_display_name_in_footer/models/__init__.py new file mode 100644 index 0000000000..a248cf2162 --- /dev/null +++ b/report_display_name_in_footer/models/__init__.py @@ -0,0 +1 @@ +from . import ir_actions_report diff --git a/report_display_name_in_footer/models/ir_actions_report.py b/report_display_name_in_footer/models/ir_actions_report.py new file mode 100644 index 0000000000..ce9145ee14 --- /dev/null +++ b/report_display_name_in_footer/models/ir_actions_report.py @@ -0,0 +1,21 @@ +from odoo import models + + +class IrActionsReport(models.Model): + _inherit = "ir.actions.report" + + def _render_qweb_pdf(self, report_ref, res_ids=None, data=None): + dnf_models = set( + self.env["ir.config_parameter"] + .sudo() + .get_param("report.display_name_in_footer_models", default="") + .replace(" ", "") + .split(",") + ) + report_model = self._get_report(report_ref).model + if ( + report_model in dnf_models or "all" in dnf_models + ) and f"-{report_model}" not in dnf_models: + data = data and dict(data) or {} + data.update({"display_name_in_footer": True}) + return super()._render_qweb_pdf(report_ref, res_ids=res_ids, data=data) diff --git a/report_display_name_in_footer/readme/CONFIGURE.md b/report_display_name_in_footer/readme/CONFIGURE.md new file mode 100644 index 0000000000..2b4b54898b --- /dev/null +++ b/report_display_name_in_footer/readme/CONFIGURE.md @@ -0,0 +1,29 @@ +To configure this module, you need to: + +1. Go to System parameters and create or edit `report.display_name_in_footer_models` + parameter. + +2. Add desired model names separated by comma. + + - If you want to print name on all reports, just write 'all' on the value. + - If you want to exclude certain models, add '-' before model name. + +3. Examples: + + - Only few models: sale.order,purchase.order,stock.picking + - All models: all + - All models except two: all,-sale.order,-purchase.order + +4. The field printed in the report will be _name_ for any type of document. If your + document doesn't have this field, please exclude from the list with '-' and the name + of the model. + +5. Compatible document layout: + + - Light + - Boxed + - Striped + +6. Compatible report types: + + - PDF diff --git a/report_display_name_in_footer/readme/CONTEXT.md b/report_display_name_in_footer/readme/CONTEXT.md new file mode 100644 index 0000000000..9ac90a4241 --- /dev/null +++ b/report_display_name_in_footer/readme/CONTEXT.md @@ -0,0 +1,10 @@ +Printing the name of the document on footer is only allowed by default to invoices by +setting `account.display_name_in_footer_models` to True. + +This module was developed because there is no way to print other document names on each +page of reports. + +It will be useful for you if you want to print the name of the document in the footer +pages to quickly know what page belongs to what document. + +Also you can define what documents will have the document name in its footer. diff --git a/report_display_name_in_footer/readme/CONTRIBUTORS.md b/report_display_name_in_footer/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..f468f56fb6 --- /dev/null +++ b/report_display_name_in_footer/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- Eduardo de Miguel ([Moduon](https://www.moduon.team/)) +- Rafael Blasco ([Moduon](https://www.moduon.team/)) diff --git a/report_display_name_in_footer/readme/DESCRIPTION.md b/report_display_name_in_footer/readme/DESCRIPTION.md new file mode 100644 index 0000000000..15b69848bb --- /dev/null +++ b/report_display_name_in_footer/readme/DESCRIPTION.md @@ -0,0 +1,6 @@ +This module extends the pagination functionality in reports to display the name of the +document on each page of PDFs, allowing you to know which document each page belongs to +and in what order they should appear. + +Pagination will appear on the left side and document name on the right side of the +footer. diff --git a/report_display_name_in_footer/readme/USAGE.md b/report_display_name_in_footer/readme/USAGE.md new file mode 100644 index 0000000000..968366dce5 --- /dev/null +++ b/report_display_name_in_footer/readme/USAGE.md @@ -0,0 +1,6 @@ +To use this module, you need to: + +1. Go to System Parameters. +2. Add your desired models or use 'all' to show document name on all type of documents. +3. Print a report for you desired model. +4. Check Footer to see document name. diff --git a/report_display_name_in_footer/static/description/icon.png b/report_display_name_in_footer/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/report_display_name_in_footer/static/description/icon.png differ diff --git a/report_display_name_in_footer/static/description/index.html b/report_display_name_in_footer/static/description/index.html new file mode 100644 index 0000000000..160d96b807 --- /dev/null +++ b/report_display_name_in_footer/static/description/index.html @@ -0,0 +1,496 @@ + + + + + +Report Display Name in Footer + + + + + + diff --git a/report_display_name_in_footer/views/report_templates.xml b/report_display_name_in_footer/views/report_templates.xml new file mode 100644 index 0000000000..0e67b26388 --- /dev/null +++ b/report_display_name_in_footer/views/report_templates.xml @@ -0,0 +1,95 @@ + + + + + + + + diff --git a/setup/report_display_name_in_footer/odoo/addons/report_display_name_in_footer b/setup/report_display_name_in_footer/odoo/addons/report_display_name_in_footer new file mode 120000 index 0000000000..762c965fce --- /dev/null +++ b/setup/report_display_name_in_footer/odoo/addons/report_display_name_in_footer @@ -0,0 +1 @@ +../../../../report_display_name_in_footer \ No newline at end of file diff --git a/setup/report_display_name_in_footer/setup.py b/setup/report_display_name_in_footer/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/report_display_name_in_footer/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)