Odoo is well known for its modular architecture and flexible customization capabilities. Among the many tools it provides, client actions play a key role in enhancing the user experience. They allow developers to define and trigger specific client-side behaviors directly from the server side, creating seamless workflows inside the Odoo interface.
With the release of Odoo 19, client actions continue to be a powerful feature that helps bridge the gap between backend logic and frontend interactivity. In this blog, we’ll walk through the process of creating and using client actions in Odoo 19, step by step.
What Are Client Actions?
Client actions are special records in Odoo that define instructions for the web client. Unlike server actions, which run Python logic on the backend, client actions are executed on the frontend, inside the user’s browser.
They are commonly used to:
- Redirect users to specific views (form, list, kanban, etc.)
- Open external URLs in a new window or tab
- Trigger custom JavaScript widgets or frontend logic
- Display wizards, reports, or dashboards
This flexibility makes client actions an essential tool for developers building customized Odoo modules.
Creating a Client Action in Odoo 19
Now that we know what client actions are and why they are useful, let’s walk through the process of configuring one in Odoo 19. We’ll build a simple dashboard that will be triggered through a menu item. This example demonstrates the core idea, and you can expand it later into more complex dashboards, wizards, or integrations.
Step 1: Defining the Client Action in XML
The first step is to declare a client action in XML. Here we use the ir.actions.client model, which connects to a tag. That tag is the bridge between the server-side definition and the client-side JavaScript component.
Filename: views/client_action_views.xml
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<!-- Define the Client Action -->
<record id="dashboard_ir_actions_client" model="ir.actions.client">
<field name="name">Dashboards</field>
<field name="tag">event_dashboard.dashboard</field>
</record>
<!-- Add a Menu Item to Trigger the Client Action -->
<menuitem name="Dashboards"
id="advanced_dashboard_menu"
sequence="1"
action="dashboard_ir_actions_client"/>
</data>
</odoo>
Key points:
- The name field defines how the action will appear.
- The tag field (event_dashboard.dashboard) is critical because it will later match with the JavaScript logic.
- The menuitem ensures the action is visible in the Odoo menu for users to access.
You could also use the parent parameter in menuitem to nest it under an existing menu.
Step 2: Creating the JavaScript Widget
After defining the client action, the next step is to write a JavaScript component that will run when the menu is clicked. Odoo 19 uses OWL for UI components, and client actions are registered in the actions registry.
Filename: static/src/js/client_action.js
/** @odoo-module */
import { registry } from '@web/core/registry';
import { Component } from "@odoo/owl";
export class AdvancedDashboard extends Component {
setup() {
// Initialization logic can go here
}
}
AdvancedDashboard.template = "event_dashboard.advanced_dashboard";
// Registering the client action
registry.category("actions").add("event_dashboard.dashboard", AdvancedDashboard);
- The AdvancedDashboard class extends OWL’s Component.
- The template assigned (event_dashboard.advanced_dashboard) tells Odoo which XML structure to display.
- The registry.category("actions") line ensures that Odoo recognizes this widget whenever the tag event_dashboard.dashboard is triggered.
This means when the user clicks the menu item, Odoo looks up the tag > finds the component > renders it in the UI.
Step 3: Adding the Template for Display
The next step is to create a template that will define what the dashboard actually looks like. This is written in an XML file inside the static/src/xml/ directory.
Filename: static/src/xml/client_action.xml
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-name="event_dashboard.advanced_dashboard">
<div>
<h1>Dashboard Rendered through Client Action</h1>
<p>This is a sample dashboard by Odoo 19 client action.</p>
</div>
</t>
</templates>
This is just a basic layout to illustrate how the flow works. You can enrich it with tables, graphs, or dynamic data using OWL bindings.
Step 4: Updating the Manifest
Finally, you must load these files into the module manifest so Odoo knows where to find them.
Filename: __manifest__.py
{
'name': 'Event Dashboard',
'version': '1.0',
'depends': ['base', 'web'],
'data': [
'views/client_action_views.xml',
],
'assets': {
'web.assets_backend': [
'event_dashboard/static/src/js/client_action.js',
'event_dashboard/static/src/xml/client_action.xml',
],
},
}
This step is critical because if the assets are not declared here, Odoo will not load your JavaScript or template files.
Additional Options for Client Actions
Client actions also support optional parameters to fine-tune their behavior:
- tag: The unique identifier linking XML to JS.
- params (optional): Dictionary values can be passed from Python to the client side, making it easy to send dynamic data.
- target (optional): Defines how the action is displayed.
- main > Opens in the main content area.
- fullscreen > Expands into full screen.
- new > Displays in a popup or dialog.
For example, setting the target to a new one can make your client action appear in a modal window, which is very useful for wizards.
Conclusion
Client actions in Odoo 19 provide a simple yet powerful way to extend the platform’s frontend. By combining XML definitions, OWL-based JavaScript components, and templates, developers can create dashboards, wizards, or pop-ups that feel native to the system.
They’re flexible enough to handle many use cases—whether it’s displaying KPIs, opening external links, or guiding users through multi-step processes. With options to control how they appear, client actions also give developers control over the user experience.
In short, mastering client actions helps developers deliver custom features that make Odoo more interactive and aligned with business needs.
To read more about How to Configure Client Action in Odoo 18, refer to our blog How to Configure Client Action in Odoo 18.