Creating Notifications in Odoo 16 for Display

September 27, 2023

In the Odoo framework, you can discover a variety of notification types. Odoo provides the capability to generate and send customized sticky notifications that are triggered by specific events or actions. There are several notification options available in Odoo, including:

1. Sticky Notification

2. Rainbow Man Effect

3. Alert

4. Raise Exception/Validation

This blog’s main emphasis is on providing a detailed guide to creating sticky notifications within Odoo.

Creating Sticky Notifications

Sticky notifications in Odoo can be tailored to suit specific functional needs, and there are two methods for creating them within the Odoo system:

Using Python

To create sticky notifications, certain parameters are necessary:

Title: This parameter sets the title of the sticky notification.

Message: The message to be displayed.

Sticky: This is an optional boolean value. When it’s set to true, the message remains on the screen until the user actively closes it or refreshes the page. Conversely, when set to false, the notification disappears after a few seconds.

Type: You can configure the type as one of the following options: success, warning, or danger. A success-type notification is displayed in blue, a warning notification in orange, and a danger notification in red.

notification = {

    'type': 'ir.actions.client',

    'tag': 'display_notification',

    'params': {

        'title': _('Warning'),

        'type': 'warning',

        'message': 'You cannot do this action now',

        'sticky': True,


 return notification
Request Your Free Quote

I have added a button to the sales form, and upon clicking this button, it will trigger the display of a notification.

<xpath expr="//field[@name='company_id']" position="after">

   <button string="Check " type="object" name="action_check" class="oe_highlight"/>


This is the XML code to add a button in the sale form.

odoo--notifications-for displays

Here is the result of the sticky notification.

Using JavaScript

Now, let’s delve into the process of crafting a custom notification using JavaScript.

The parameters for generating sticky notifications with JavaScript mirror those employed in the Python function. Moreover, there is an optional parameter known as className, which grants us the flexibility to define a CSS class for additional customization.

Here is the JavaScript syntax for crafting a custom notification:

Using this syntax will result in displaying the notification as shown above.


    this.displayNotification("title", "message", "sticky", "className");


Below is an example of a sticky notification crafted using JavaScript.


   type: 'warning',

   title: _t('Quiz validation error'),

   message: message,

   sticky: true


Display notifications are intentionally designed to be unobtrusive. They manifest as brief, temporary pop-up messages that don’t obstruct the user’s interaction with the system. Users can seamlessly carry on with their tasks while remaining informed by the message.

Whether it’s conveying information about completed tasks, serving as reminders for upcoming deadlines, or presenting users with pertinent links, the display notification feature in Odoo serves to elevate user engagement and facilitates smoother interactions within the system.


"Unlock the Full Potential of Your Business with Odoo ERP!"

"Get a Cost Estimate for Your ERP Project, Absolutely FREE!"

Get a Free Quote

Leave a Reply

Your email address will not be published. Required fields are marked *