跳至内容
菜单
此问题已终结
5 回复
8065 查看

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?

形象
丢弃

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

编写者

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.

最佳答案

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


形象
丢弃
编写者

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

编写者

@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.

相关帖文 回复 查看 活动
3
10月 24
17471
5
9月 24
10213
1
12月 22
3609
3
5月 19
15177
1
11月 17
5425