This question has been flagged
1 Reply
2646 Views

Hello i have some doubt about the javascript and odoo, i have the following


bus = self.env['bus.bus']

message = {'subject': 'Test','body': 'Nuevo turno','mode': 'sticky','siguiente' : folio }

bus.sendone('notify_turnero_19', message)


i send a message via the bus module


i can catch the message in the odoo backend this way


odoo.define('web_notify.WebClient', function (require) {"use strict";
var WebClient = require('web.WebClient');

var base_bus = require('bus.bus');

var session = require('web.session');console.log(session);
WebClient.include({

show_application:function() {

var res = this._super();this.start_polling();returnres },


start_polling:function() {this.channel_turnero = 'notify_turnero_' + session.uid;


base_bus.bus.add_channel(this.channel_turnero);

base_bus.bus.on('notification', this, this.bus_notification);

base_bus.bus.start_polling(); },


bus_notification:function(notifications) {

varself = this;_.each(notifications, function (notification) { 

varchannel = notification[0];

varmessage = notification[1];

if (channel === self.channel_turnero) {

self.on_message_turnero(message);

} }); },


on_message_turnero:function(message){

console.log(message);

}});
});

In the console.log(message); i get the message if the user id is 19, it work fine. but i need this workflow to work on a page



<recordid="turnero_web"model="ir.ui.view"><fieldname="name">Turnero DUfield><fieldname="type">qwebfield><fieldname="arch"type="xml"><tname="turnero_web"t-name="turnero_web"><tt-call="website.layout">
t>t>field>record>

<recordid="clases_page"model="website.page"><fieldname="url">/turnerofield><fieldname="website_published">Truefield><fieldname="view_id"ref="turnero_web"/>record>


and i called the js in this new page and i get

Missing dependencies: (2) ['web.WebClient', 'bus.bus']
Rejected modules: ['portal.portal']

help me understand how the js works different in a website page, and the normal odoo interface, im working with odoo 11


Avatar
Discard
Best Answer

Have you solved the problem yet? I also had the same problem with you

Avatar
Discard