This question has been flagged
5 Replies
6304 Views

I'm trying to figure out how to make a popup window that is shown to a specific user when a record is created. Something like chat.

I know that first I need to configure longpolling.

Than I need to create a template of the popup for the js widget. But I don't have any idea how to show the popup to the user if he is logged in? I'm looking at the mail addon but I just cannot figure out the workflow and how to show the popup. 

I can't find any documentation on google for this.

So can someone explain the workflow and how to push actions to the users browser?

Avatar
Discard

How to display confirmation display box / message box on button click: https://goo.gl/6P7aR1

Author

like always your blogspot is NOT useful and you again totally missed the point of the question! By now I figured that I need to use the bus model. Just need to figure out how to use the bus module. What your blogspot tries to do with actions can be done with the confirm attribute in the button tag in a qweb view. Like in one line.

Best Answer

Hi

1) at server side you have to register your channel to poll using override _poll controller
(there is existing partner channel available you may use it)
ref: https://github.com/odoo/odoo/blob/12.0/addons/calendar/controllers/bus.py#L11

2) using bus you can push notification to a channel (created at step
ref: https://github.com/odoo/odoo/blob/12.0/addons/calendar/models/calendar.py#L477

3) at client side listen to bus for notification of channel (write a custom widget to handle notification in your case popup)
ref: https://github.com/odoo/odoo/blob/12.0/addons/calendar/static/src/js/base_calendar.js#L101


Avatar
Discard
Author

Thanks... now I just have to figure out the javascript portion :/ I hate javascript!

javascript isn't that bad ;). post it if you have any query

Author

@Ravi Gadhia so a javascrip question... I've managed to create the popup with the help of the calendar like you suggested. Now I need two rpc calls. this.rpc("/calls/create/task", {

call_id: eid,

}).then(function(r) {

this.task_id = r;

this.rpc("/web/action/load", {

action_id: "tabla_asterisk_calls.action_show_call_ticket",

}).then(function(a){

a.res_id = self.task_id;

return self.do_action(a);

});

});

Can you help me with this.