Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
      • Get a Tailored Demo
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +32 2 290 34 90
    • Get a Tailored Demo
  • Pricing
  • Help
  1. APPS
  2. Extra Tools
  3. CMS status message v 16.0
  4. Sales Conditions FAQ

CMS status message

by Camptocamp https://github.com/OCA/website-cms , Odoo Community Association (OCA) https://github.com/OCA/website-cms
Odoo
v 16.0 Third Party 206
Download for v 16.0 Deploy on Odoo.sh
Apps purchases are linked to your Odoo account, please sign in or sign up first.
Availability
Odoo Online
Odoo.sh
On Premise
Odoo Apps Dependencies Discuss (mail)
Lines of code 244
Technical Name cms_status_message
LicenseLGPL-3
Websitehttps://github.com/OCA/website-cms
Versions 10.0 11.0 13.0 14.0 16.0
You bought this module and need support? Click here!

CMS status message

Beta License: LGPL-3 OCA/website-cms Translate me on Weblate Try me on Runboat

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.

Table of contents

  • Usage
    • Python code
    • Autodismiss
    • Javascript code
    • Customize appereance
    • Test your theme look and feel
  • Changelog
    • 16.0.1.0.0 (2023-05-13)
    • 13.0.1.0.1 (2021-08-23)
    • 11.0.1.3.0 (2018-08-07)
    • 11.0.1.2.0 (2018-08-07)
    • 11.0.1.1.0 (2018-04-22)
    • 11.0.1.0.0 (2018-01-18)
  • Bug Tracker
  • Credits
    • Authors
    • Contributors
    • Maintainers

Usage

Python code

Set a message:

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:

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

Messages will be displayed like this:

https://raw.githubusercontent.com/OCA/website-cms/16.0/cms_status_message/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

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.

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.

Changelog

16.0.1.0.0 (2023-05-13)

Features

  • Migration to v16 (#127)
  • Get rid of website dependency

13.0.1.0.1 (2021-08-23)

Features

  • Migration to v13 (#111)

11.0.1.3.0 (2018-08-07)

Improvements

  • Get rid of example package

    The example package was there only to show how a message would look like. But in real life you want always to verify how they look like with your theme styles applied.

    Now we have a new route /cms/status-message/display-test to check them. cms_status_message_example module has been removed.

11.0.1.2.0 (2018-08-07)

Improvements

  • Add auto-dimiss option

    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
    

    Check README for further info.

11.0.1.1.0 (2018-04-22)

Improvements

  • Improve JS API

    1. load qweb template on demand
    2. load qweb template only if not loaded yet
    3. use promises for rendering

    We load qweb templates via JS. Prior to this change we got 1 request every time, on every page load per each template, even if we were not using any status message feature.

    Now we load templates only when needed and we load them only if not loaded yet, lowering page load time a bit :)

    Plus, rendering now returns a promise object so you can chain calls and do things when rendering is really finished.

11.0.1.0.0 (2018-01-18)

Upgrade to v11

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 to smash it by providing a detailed and welcomed feedback.

Do not contact contributors directly about support or help with technical issues.

Credits

Authors

  • Camptocamp

Contributors

  • Simone Orsi <simone.orsi@camptocamp.com>

Maintainers

This module is maintained by the OCA.

Odoo Community Association

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.

Current maintainer:

simahawk

This module is part of the OCA/website-cms project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

Please log in to comment on this module

  • The author can leave a single reply to each comment.
  • This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
  • If you want to start a discussion with the author, please use the developer contact information. They can usually be found in the description.
Please choose a rating from 1 to 5 for this module.
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with