mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[MIG] web_notify: Migration to 12.0
Add self-test buttons in demo environment, Updated readme to show how to test it. Add buttons to users form Do not rely on SUPERUSER_ID and avoid getattr usage
This commit is contained in:
@@ -2,8 +2,9 @@ odoo.define('web_notify.WebClient', function (require) {
|
||||
"use strict";
|
||||
|
||||
var WebClient = require('web.WebClient');
|
||||
var base_bus = require('bus.bus');
|
||||
var base_bus = require('bus.Longpolling');
|
||||
var session = require('web.session');
|
||||
require('bus.BusService');
|
||||
|
||||
|
||||
WebClient.include({
|
||||
@@ -15,10 +16,10 @@ WebClient.include({
|
||||
start_polling: function() {
|
||||
this.channel_warning = 'notify_warning_' + session.uid;
|
||||
this.channel_info = 'notify_info_' + session.uid;
|
||||
base_bus.bus.add_channel(this.channel_warning);
|
||||
base_bus.bus.add_channel(this.channel_info);
|
||||
base_bus.bus.on('notification', this, this.bus_notification);
|
||||
base_bus.bus.start_polling();
|
||||
this.call('bus_service', 'addChannel', this.channel_warning);
|
||||
this.call('bus_service', 'addChannel', this.channel_info);
|
||||
this.call('bus_service', 'on', 'notification', this, this.bus_notification);
|
||||
this.call('bus_service', 'startPolling');
|
||||
},
|
||||
bus_notification: function(notifications) {
|
||||
var self = this;
|
||||
@@ -33,14 +34,10 @@ WebClient.include({
|
||||
});
|
||||
},
|
||||
on_message_warning: function(message){
|
||||
if(this.notification_manager) {
|
||||
this.notification_manager.do_warn(message.title, message.message, message.sticky);
|
||||
}
|
||||
this.do_warn(message.title, message.message, message.sticky);
|
||||
},
|
||||
on_message_info: function(message){
|
||||
if(this.notification_manager) {
|
||||
this.notification_manager.do_notify(message.title, message.message, message.sticky);
|
||||
}
|
||||
this.do_notify(message.title, message.message, message.sticky);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user