Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

License: LGPL-3

CMS status message

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.

Usage

Python code

Set a message:

msg = _('My important message.')
if request.website:
    request.website.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:

msg = _('Watch out!')
if request.website:
    request.website.add_status_message(msg, type_='warning', title='Oh no')

Messages will be displayed like this:

./images/preview.png

Javascript code

Dependencies:

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

Inject a custom message on the fly:

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:

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.

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed feedback.

Credits

Contributors

Maintainer

Odoo Community Association

This module is maintained by the OCA.

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

To contribute to this module, please visit https://odoo-community.org.

Release files for odoo10-addon-cms-status-message 10.0.1.1.0.99.dev6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for odoo10-addon-cms-status-message 10.0.1.1.0.99.dev6
File Interpreter ABI Platform
odoo10_addon_cms_status_message-10.0.1.1.0.99.dev6-py2-none-any.whl Python 2 none any Details

Release files / odoo10_addon_cms_status_message-10.0.1.1.0.99.dev6-py2-none-any.whl

Download URL odoo10_addon_cms_status_message-10.0.1.1.0.99.dev6-py2-none-any.whl
Size 78.8 kB
Tags Python 2
SHA-256 checksum
How to use checksums
3a15b75bec691591eec6e376f3122d4f1d00c03be9663e205cdb18aa8c298009
BLAKE2b-256 checksum
How to use checksums
56ae47c8dcd226235d0f77ab168f17cee83ce91211dc856fdbb51769f927739f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.10
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page