diff options
| author | qsm-odoo <qsm@odoo.com> | 2019-04-18 10:01:40 +0000 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2019-04-24 13:21:41 +0000 |
| commit | b94395b50175925fc7d1bd3655e5facb78a8ba2b (patch) | |
| tree | a6a3a20555ece8dcff22ffbd9cd27170b839e2ea /addons/web/static/src/js/services | |
| parent | 09c3df17cd940a8d1bda4cc265ef5f24e3aa8ecc (diff) | |
[IMP] web, *: share and improve notification system
* barcodes, calendar, partner_autocomplete, web_settings_dashboard
Make the notification system better, using bootstrap toast component,
and make it available in the frontend.
The toast component allowed to remove some JS code and made the
component customizable by themes but it had to be reviewed/fixed to make
it functional (maybe bootstrap will review its work in next versions).
This work should still be improved because there are still too many
ways (deprecated and not deprecated) to instantiate toasts in the
backend. The goal here was however to make the toasts more modern and
make them available in the frontend.
This work is needed for some tasks. @kig-odoo and @fja-odoo made a
pre-work to instantiate toasts in the frontend for their respective
tasks. This commit unifies the system.
Part of https://github.com/odoo/odoo/pull/32793
task-1970731
closes odoo/odoo#32793
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Diffstat (limited to 'addons/web/static/src/js/services')
| -rw-r--r-- | addons/web/static/src/js/services/notification_service.js | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/addons/web/static/src/js/services/notification_service.js b/addons/web/static/src/js/services/notification_service.js index a0d2720604b..ea16d9ef66f 100644 --- a/addons/web/static/src/js/services/notification_service.js +++ b/addons/web/static/src/js/services/notification_service.js @@ -1,9 +1,10 @@ odoo.define('web.NotificationService', function (require) { -"use strict"; +'use strict'; var AbstractService = require('web.AbstractService'); var Notification = require('web.Notification'); var core = require('web.core'); + var id = 0; /** @@ -16,9 +17,7 @@ var id = 0; * by using this file. The proper way is to use the do_warn or do_notify * methods on the Widget class. */ - var NotificationService = AbstractService.extend({ - custom_events: { close: '_onCloseNotification', }, @@ -37,8 +36,8 @@ var NotificationService = AbstractService.extend({ /** * It may sometimes be useful to close programmatically a notification. For - * example, when there is a sticky notification that warns the user about - * some condition (connection lost), but the condition do not apply anymore. + * example, when there is a sticky notification warning the user about some + * condition (connection lost), but the condition does not apply anymore. * * @param {number} notificationId * @param {boolean} [silent=false] if true, the notification does not call @@ -105,9 +104,7 @@ var NotificationService = AbstractService.extend({ }, }); - core.serviceRegistry.add('notification', NotificationService); - return NotificationService; }); |
