OdooWiki OCA HUB

CMS status message

cms_status_message folder_open OCA/website-cms open_in_new
Uncategorised License: LGPL-3

A "status message" is an important message that you want to show to users.

For instance: a user submit a form or does a specific action and you want to report the status of this action like "your profile has been updated" or "Your upgrade has been successful.".

This module allows to easily display this kind of messages to your users.

Messages are displayed using Twitter bootstrap alerts.

You can add several messages: they will be displayed one after another.

auto_awesome What this module does

AI-generated from the code · Odoo 16.0

Lets developers and website builders show short status messages (info, success, warning, error) to visitors, for example after a form is submitted. Messages appear as dismissible alerts on portal pages and can disappear automatically.

This module adds a simple way to display temporary messages to website and portal users, such as "your profile has been updated" or "your upgrade has been successful". Messages are stored in the user's session and shown as coloured alert boxes (using standard Bootstrap styles) on the next page they see.

  • Messages can have a title and a type: info, success, warning or danger. If no title is given, a default title is used based on the type (Info, Success, Warning, Error).
  • Alerts can be dismissible (with a close button) or not. When dismissible, they can also disappear automatically after a delay.
  • The automatic disappearance is controlled by two system settings: one to turn it on or off, and one to set the timeout in milliseconds. By default it is on with an 8-second timeout.
  • Messages are added to the session and then read and removed when displayed, so they only appear once.
  • On portal pages, the messages are inserted at the top of the page layout.
  • A test page at /cms/status-message/display-test lets you try the feature by entering a message and submitting a form; it shows the message in all four types.

The module extends the ir.http model with methods to add, get and clear status messages, and adds templates for rendering them. It depends on the web and portal modules.

Depends on

webportal

Required by other modules

Models and fields (1)
  • ir.http · extends an existing model

Text generated by AI (DeepSeek) from reading the Odoo 16.0 code on GitHub; it may contain mistakes, so check the code before deciding. View the code on GitHub

Availability by version

Reviewed: 2026-11-03
Confirmed (verified in repository and branch) Estimated (unverified) No information

Confirmation status: 3 confirmed, 6 with no information of 9 versions.

Sources · Odoo 13.0

Confirmed on 2026-11-03 in branch 13.0 of OCA/website-cms.

terminal Installation and usage

OCA documentation · Odoo 16.0

Python code

Set a message:

.. code:: python

    msg = _('My important message.')
    env["ir.http"].add_status_message(msg)

By default the message type is ``info``. The title (the label at the
beginning of the message) matches the message type:

-  'info': 'Info'
-  'success': 'Success'
-  'danger': 'Error'
-  'warning': 'Warning'

You can change message parameters:

.. code:: python

    msg = _('Watch out!')
    env["ir.http"].add_status_message(msg, kind='warning', title='Oh no')

Messages will be displayed like this:

.. image:: ./images/preview.png

Autodismiss

By default messages will be auto-dismissed after 8 seconds. You can turn this off by setting an ir.config_param like:

cms_status_message.autodismiss = 0

You can customize the timeout by setting the key:

cms_status_message.autodismiss_timeout = 3000  # milliseconds

You can also customize this on demand when you create the message:

msg = _('I will disappear more slowly')
options = {'autodismissTimeout': 10000}
env["ir.http"].add_status_message(msg, dismiss_options=options)

Javascript code

Dependencies:

FIXME v16

.. code:: javascript


    var msg_tool = require('cms_status_message.tool');
    var core = require('web.core');
    var _t = core._t;

Inject a custom message on the fly:

.. code:: javascript

    msg = {
        'msg': _t('Item unpublished.'),
        'title': _t('Warning'),
        'type': 'warning'
    }
    msg_tool.render_messages(msg).then(function(html) {
        // wipe existing
        $('.status_message').remove();
        // inject new
        $(html).hide().prependTo('#wrap').fadeIn('slow');
    });


Add a status message to the session, useful if you want to show the
message only after a redirect:

.. code:: javascript

    var msg =  _t('Contratulations! You made it!.');
    var options = {'title': _('My title'), 'dismissible': false};
    msg_tool.add_message(msg, options);

Customize appereance

By default the alert box is added on top of <main /> content. If you want to customize this behavior just override or disable cms_status_message.add_status_message template.

Test your theme look and feel

Go to `/cms/status-message/display-test` to see how messages will look like
when your theme is applied.

No verified information in OCA: Installation, Configuration.

info

Data imported from GitHub: this sheet reflects the latest catalog review, not a live lookup. Always check the module documentation and staging before installing in production.