Package: odoo13-addon-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.Table of contentsUsagePython codeAutodismissJavascript codeCustomize appereanceTest your theme look and feelKnown issues / RoadmapChangelog11.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 TrackerCreditsAuthorsContributorsMaintainersUsagePython codeSet a message:msg=_('My important message.')ifrequest.website:request.website.add_status_message(msg)By default the message type isinfo. 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!')ifrequest.website:request.website.add_status_message(msg,type_='warning',title='Oh no')Messages will be displayed like this:AutodismissBy 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 = 0You can customize the timeout by setting the key:cms_status_message.autodismiss_timeout = 3000  # millisecondsYou can also customize this on demand when you create the message:msg=_('I will disappear more slowly')options={'autodismissTimeout':10000}ifrequest.website:request.website.add_status_message(msg,dismiss_options=options)Javascript codeDependencies:varmsg_tool=require('cms_status_message.tool');varcore=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:varmsg=_t('Contratulations! You made it!.');varoptions={'title':_('My title'),'dismissible':false};msg_tool.add_message(msg,options);Customize appereanceBy default the alert box is added on top of<main />content. If you
want to customize this behavior just override or disablecms_status_message.add_status_messagetemplate.Test your theme look and feelGo to/cms/status-message/display-testto see how messages will look like
when your theme is applied.Known issues / RoadmapGet rid ofwebsitedependency and move features to a standalone model.Changelog13.0.1.0.1 (2021-08-23)FeaturesMigration to v13 (#111)11.0.1.3.0 (2018-08-07)ImprovementsGet rid of example packageThe 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-testto check them.cms_status_message_examplemodule has been removed.11.0.1.2.0 (2018-08-07)ImprovementsAdd auto-dimiss optionBy 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 = 0You can customize the timeout by setting the key:cms_status_message.autodismiss_timeout = 3000  # millisecondsCheck README for further info.11.0.1.1.0 (2018-04-22)ImprovementsImprove JS APIload qweb template on demandload qweb template only if not loaded yetuse promises for renderingWe 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 v11Bug TrackerBugs are tracked onGitHub 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 welcomedfeedback.Do not contact contributors directly about support or help with technical issues.CreditsAuthorsCamptocampContributorsSimone Orsi <simone.orsi@camptocamp.com>MaintainersThis 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.This module is part of theOCA/website-cmsproject on GitHub.You are welcome to contribute. To learn how please visithttps://odoo-community.org/page/Contribute.