🚀 Celebrate the launch of Odoo 19.0 with us! Enjoy 19% OFF all our Odoo 19-compatible products. 🎉
Can I Create Custom Print Scenario Actions in Odoo?

Can I Create Custom Print Scenario Actions in Odoo?

Odoo’s Print Scenario system (part of Direct Print PRO) is a powerful tool for automating printing actions based on specific events – like validating a delivery order or updating an invoice status. However, it’s important to understand how these actions work and who can create or customize them.

For End Users: Why You Can’t Create Custom Print Scenario Actions

We often get questions like:

“Can I create a new Print Scenario Action with my own trigger?”

Unfortunately, the answer is: not directly – at least not from the Odoo user interface.

Why Not?

Print Scenario Actions are hardcoded triggers linked to specific methods in Odoo’s backend (Python code). That means creating or modifying them requires technical development skills and access to the Odoo server codebase.

Example: Our predefined scenario action “Print document on Transfer (after validation)” is triggered when the following Odoo method is called:

def button_validate(self):
    res = super(StockPicking, self).button_validate()

    if res is True:
        self.print_scenarios(action='print_document_on_transfer')

    return res

As you can see, the logic that triggers printing is embedded directly in Odoo’s business process (in this case, delivery validation). This is not something a non-developer can configure through the UI.

For Developers: How to Add Custom Print Scenario Triggers

Print scenarios are highly flexible for developers and can be implemented in two ways:

1. Simple Triggers: Call print_scenarios()

If you want to trigger printing after a standard Odoo operation (e.g., when a field is updated or a button is clicked), override the relevant method in your extension module and call:

self.print_scenarios(action='your_custom_action_code')

Then, define your scenario action via XML:

<record id="print_document_on_custom_event" model="printnode.scenario.action">
    <field name="name">Print Document on Custom Event</field>
    <field name="code">print_document_on_custom_event</field>
    <field name="model_id" eval="ref('stock.model_stock_picking')"/>
    <field name="reports_model_id" eval="ref('stock.model_stock_picking')"/>
</record>

2. Advanced Triggers: Define _scenario_<action_code>

For complex conditions or cross-model printing logic, define a method like:

def _scenario_print_document_on_custom_event(
    self, scenario, report_id, printer_id, number_of_copies, options
):
    # Custom logic to prepare data and print

This method is invoked by the core printing engine if model_id != reports_model_id or if special logic is needed.

XML Definition Explained

Every Print Scenario Action must be declared in XML like this:

Field

Description

name

Display name of the action

code

Unique code used in print_scenarios(action=...)

model_id

Model where the trigger occurs (e.g. stock.picking)

reports_model_id

Model the report is generated from (usually same as model_id)

Need Help?

Print Scenarios are powerful but require Odoo development knowledge to set up properly. If you want to implement a custom print trigger – like printing when multiple fields are updated or under advanced conditions – we can help.

📩 Contact us to request a paid development of your custom scenario: Support Portal

Related Posts