
Learn how to display sticky notifications in Odoo to keep important messages visible for users. This guide explains the setup and code to add alerts in Odoo.
In Odoo notifications can enrich user experience. This is especially true after specific actions. Feedback is required. Users need alerts. Sticky notifications represent an effective strategy. They keep the message on-screen until it is dismissed. This guide delves into sticky notifications. We explore how to return an action with a sticky notification in Odoo. This ensures that users receive persistent critical messages. The messages display on their screens.
A sticky notification is a kind of notification. It stays visible on screen until user closes it manually. In Odoo notifications can be set as sticky. This makes them perfect for showing must-not-miss details.
Here's example. It shows usage of sticky notification in Odoo action. It sends a message to user. This message stays on screen until it’s closed manually.
from odoo import models, _
class CustomModel(models.Model):
_name = 'custom.model'
def action_show_sticky_notification(self):
return {
'type': 'ir.actions.client',
'tag': 'display_notification',
'params': {
'title': _('Attention'),
'message': _("This is an important sticky notification."),
'type': 'warning', # Options: 'info', 'warning', 'danger'
'sticky': True, # Set to True to make the notification sticky
}
}
Sticky notifications prove being useful in certain scenarios. A description follows:
A scenario is imagined. An Odoo administrator has to inform users. Users need to set settings in a module properly. A sticky notification is implemented. It ensures that alert will stay. This is until user acts. In this way, nothing is missed.
Utilize sticky notifications in Odoo. This is for the communication of vital messages. These messages need attention. Improve functionality. Improve usability of Odoo applications. This approach ensures user is informed. It guides them to necessary actions. The action is directly on their screen.
Your email address will not be published. Required fields are marked *