Report Printed Flag
report_printed_flag · OCA/reporting-engine
-
Security22/251 minor finding
-
Activity25/25Last human commit 1 month ago
-
Required by20/252 modules depend on it
-
Maturity5/25In 1 Odoo series since 17.0
Heuristic over the facts below, not an audit · How it's computed
Migration considerations
ReportPrintedConfig— Migrating to 19.0: `_sql_constraints` is ignored and its constraints are silently not created: declare `models.Constraint` attributes instead. migration-sql-constraints · sourceview_report_printed_config_tree— Migrating to 18.0: the `tree` view type was renamed to `list` (`<list>` roots, `view_mode`). migration-view-tree-tag · sourceview_report_printed_log_tree— Migrating to 18.0: the `tree` view type was renamed to `list` (`<list>` roots, `view_mode`). migration-view-tree-tag · source
Migration review checklist, not a compatibility verdict. "Migrating to X.0" applies once you upgrade to that version; "Since X.0" means this version already ignores or rejects that code. Methodology
Description
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
printedBoolean field - A
printed_log_idsOne2many relation to audit logs - A
printed_report_namescomputed field with printed report names - An
action_view_printed_logs()method
- A
- 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:
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.mixinto gain printed field support - Domain expressions must be valid Python domains
Dependencies
- Odoo dependencies
- Python dependencies
- None
- System dependencies
- None
- Required by
- account_invoice_report_printed_flag, stock_picking_report_printed_flag
Code analysis
Extracted from the source by best-effort static analysis (no code is executed); details may be incomplete.
Views touched 5
| XML ID | Name | Model | Type | Status |
|---|---|---|---|---|
view_report_printed_config_form |
report.printed.config.form | report.printed.config | form | New |
view_report_printed_config_search |
report.printed.config.search | report.printed.config | search | New |
view_report_printed_config_tree |
report.printed.config.tree | report.printed.config | tree | New |
view_report_printed_log_search |
report.printed.log.search | report.printed.log | search | New |
view_report_printed_log_tree |
report.printed.log.tree | report.printed.log | tree | New |
HTTP endpoints 0
No HTTP endpoints found for this module.
Models touched 5
No new fields.
Public methods (0)No public methods.
-
activeBooleandefault=True -
allowed_model_idsMany2many → ir.modeldefault=<expr> args: 'ir.model' -
company_idMany2one → res.companycomodel_name='res.company'default=<expr>ondelete='cascade'required=True -
display_nameCharcompute='_compute_display_name'store=True -
line_idsOne2many → report.printed.config.linestring='Report Rules' args: 'report.printed.config.line', 'config_id' -
modelCharreadonly=Truerelated='model_id.model'store=Truestring='Technical Model' -
model_idMany2one → ir.modeldomain="[('transient', '=', False), ('id', 'in', allowed_model_ids)]"ondelete='cascade'required=True args: 'ir.model' -
nameCharrequired=Truetranslate=True -
noteText -
report_printed_log_activeBooleandefault=Truestring='Enable Printed Logs' -
report_printed_names_activeBooleandefault=Truestring='Enable Printed Report Names'
No public methods.
-
config_idMany2one → report.printed.configondelete='cascade'required=True args: 'report.printed.config' -
domainChar -
report_idMany2one → ir.actions.reportrequired=True args: 'ir.actions.report'
No public methods.
-
company_idMany2one → res.companyrequired=True args: 'res.company' -
nameCharrequired=True -
report_idMany2one → ir.actions.reportondelete='cascade'required=True args: 'ir.actions.report' -
res_idMany2oneReferenceindex=Truemodel_field='res_model'required=Truestring='Related Record' -
res_modelCharindex=Truerequired=True -
user_idMany2one → res.usersdefault=<expr>required=True args: 'res.users'
No public methods.
-
printedBooleancopy=Falsedefault=Falsehelp='Indicates whether at least one configured report has been printed for this record.'index=True -
printed_log_idsOne2many → report.printed.loghelp='Technical relation to printed logs using a generic reference pattern (res_model, res_id). Only logs related to this model type are included.'string='Print Logs' args: 'report.printed.log', 'res_id' -
printed_report_namesCharcompute='_compute_printed_report_names'help='Comma-separated list of printed report names, computed from related printed logs. Only active if enabled in configuration.'store=Truestring='Printed Reports Names'
-
action_view_printed_logs(self)Open a tree view displaying printed logs related to this record. Returns: dict: Standard Odoo action opening ``report.printed.log`` records filtered by this record's (res_model, res_id). Notes: - Uses ensure_one() as the action is record-specific - Designed to be called from UI buttons