Print Policy Mixin
Description
Print Policy Mixin is a core mixin module in the
@simetri-sinergi-id/ssi-mixin technology suite for Odoo 15.
It provides a standardised, configurable print-document framework
that adds a Print button to any Odoo model via an abstract
mixin — without requiring changes to the base model's views.
The module ships three main components:
-
mixin.print_document — abstract mixin that automatically
injects a Print button into the form-view header and
list-view header when
_automatically_insert_print_button = True
is set on the subclass.
-
print_document_type — a named document type (scoped to a
specific model) that groups the reports available for printing;
its
code is generated from a sequence.
-
ir.actions.report extension — adds
print_document_type_ids to link reports to types,
a print_python_code condition evaluated at print
time, and a print_multi flag for batch printing.
Key Features
- Auto-Injected Print Button: One flag enables the Print button on both form and list views with zero view changes.
- Document Type Grouping: Group multiple reports per model under named types for a clean UI.
- Python-Based Print Policy: Control report visibility per record with a Python expression evaluated at runtime.
- Batch / Multi-Record Printing: Flag reports for batch printing from the list view.
- Group-Based Access: Optionally restrict individual reports to specific user groups.
- Mixin Design: Inherit
mixin.print_document in any model — no structural changes required.
- Open Source: AGPL-3.0 license with community-driven improvements.
Use Cases / Context
Use this mixin whenever you need a flexible, policy-driven print button on a custom Odoo model:
- Sales Quotations: Offer different quote layouts depending on the customer type via Python conditions.
- HR Contracts: Print contract PDFs with different templates per contract type.
- Invoices / Delivery Orders: Group invoice and packing-slip reports under separate document types.
- Batch Operations: Allow warehouse staff to print multiple delivery slips in one click from the list view.
- Custom Transactional Models: Any model that needs contextual, role-based report selection.
Simply inherit mixin.print_document, set _automatically_insert_print_button = True, and configure Print Document Types via the menu.
Installation & Usage
- Clone branch 15.0 of the repository: https://github.com/simetri-sinergi-id/ssi-mixin
- Add the path to this repository in your Odoo configuration (
addons-path).
- Update the module list (ensure you are in developer mode).
- Go to Apps → Apps → Main Apps, search for Print Policy Mixin, and install.
- Go to Reporting → Print Document Types to create types and link reports.
- In your custom model, inherit the mixin and set the flag:
_inherit = ["mixin.print_document"]
_automatically_insert_print_button = True
FAQ
-
Standalone?
No — it is a mixin foundation. Install it as a dependency of your custom module.
-
Odoo Version?
Odoo 15.0.
-
Can I control which users see which reports?
Yes — use
print_python_code on the report or restrict via Odoo groups.
-
Batch printing from list view?
Yes — enable
print_multi on the report action.
-
Contribute?
Fork, branch, and submit a pull request on GitHub.
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 smash it by providing detailed and welcomed feedback.
Credits & Contributors
This module is developed and maintained by PT. Simetri Sinergi Indonesia.
- Core Development:
- Maintenance: PT. Simetri Sinergi Indonesia
- Special Thanks: To the Odoo Community Association (OCA) for the development guidelines and best practices.