diff --git a/report_printed_flag/README.rst b/report_printed_flag/README.rst new file mode 100644 index 0000000000..3b122084d0 --- /dev/null +++ b/report_printed_flag/README.rst @@ -0,0 +1,184 @@ +=================== +Report Printed Flag +=================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:5d5058bfc9e97f0956c7e54b952e643c0f1a9dcb2ac49f57270d430c82c62804 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Freporting--engine-lightgray.png?logo=github + :target: https://github.com/OCA/reporting-engine/tree/17.0/report_printed_flag + :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-17-0/reporting-engine-17-0-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/reporting-engine&target_branch=17.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module provides a generic and extensible configuration layer to +mark records as printed when specific PDF reports are generated. + +Main features: + +- **Reusable Mixin** (``report.printed.mixin``) that any model can + inherit to gain: + + - A ``printed`` Boolean field + - A ``printed_log_ids`` One2many relation to audit logs + - A ``printed_report_names`` computed field with printed report names + - An ``action_view_printed_logs()`` method + +- Generic configuration per company and model +- Per-report configuration using rules +- Optional domain conditions per report +- Automatic printed flag update +- Optional logging of report executions +- Optional computation of printed report names +- Full multi-company support with isolated configurations +- User interface for browsing printed report logs + +Extension modules simply inherit the mixin: + +.. code:: python + + class AccountMove(models.Model): + _name = 'account.move' + _inherit = ['account.move', 'report.printed.mixin'] + +All printed flag functionality is inherited automatically. + +Limitations: + +- Only applies to QWeb PDF reports (``qweb-pdf``) +- Extension modules must inherit ``report.printed.mixin`` to gain + printed field support +- Domain expressions must be valid Python domains + +.. 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 +===== + +For End Users +============= + +1. Install ``report_printed_flag`` module +2. Install extension modules that support printed flags (e.g., + ``report_printed_flag_account``) +3. Go to *Settings > Reporting > Printed Flag > Configurations* +4. Create a configuration for your model (Company + Model) +5. Add report rules (select report + optional domain condition) +6. Generate a configured report from a document (e.g., print an invoice) + +Result: + +- The ``printed`` field is automatically set to ``True`` +- A log entry is created (if enabled in configuration) +- Printed report names are computed (if enabled in configuration) + +Access logs via: + +*Settings > Reporting > Printed Flag > Logs* + +For Module Developers +===================== + +To add printed flag support to a custom model: + +1. Create your model inheriting from ``report.printed.mixin``: + + class MyModel(models.Model): \_name = 'my.model' \_inherit = + ['my.model', 'report.printed.mixin'] + +2. Create QWeb PDF reports for your model (standard Odoo process) + +3. Instruct users to configure which reports trigger the printed flag + via the UI + +That's it! The mixin provides all field and method implementations +automatically. + +Optional: Add UI Elements +------------------------- + +You may optionally add buttons to your views to open the logs: + +:: + +