コンテンツへスキップ
メニュー
この質問にフラグが付けられました
5 返信
10882 ビュー

Hello, I'm trying to replicate some functionality from Slack into Odoo Discuss. We have some custom scripts that monitor our web businesses and post to an Odoo Discuss/Chat channel automatically. After the script runs, channel members are not notified and cannot even see the message until after refreshing the browser.

Here's the script:

import xmlrpc.client

def postProcessing(message):
url = "https://x.odoo.com"
db = 'zzzzzzzzz'
username = 'xxxxxxx'
password = 'yyyyyyy'

common = xmlrpc.client.ServerProxy('{}/xmlrpc/2/common'.format(url))
common.version()

{
"server_version": "8.0",
"server_version_info": [8, 0, 0, "final", 0],
"server_serie": "8.0",
"protocol_version": 1,
}

uid = common.authenticate(db, username, password, {})


models = xmlrpc.client.ServerProxy('{}/xmlrpc/2/object'.format(url))

id = models.execute_kw(db, uid, password, 'mail.message', 'create', [{
'model': 'mail.channel',
'res_id': 14, #from/reference channel
'body': message, # here add the message body
'channel_ids': [14], #channel ID to post to
'author_id': 1,
'author_avatar': False
}])

print (id)

postProcessing("test?")

The script successfully posts a message, but it only appears in the channel after refreshing the browser. Even clicking around in Odoo and coming back doesn't refresh it. How to get it to show automatically?

アバター
破棄

Hi,

Can you try after setting the workers=1 in your .conf file?

i have the same problem. have you found a solution to this problem?

著作者

Unfortunately never solved

最善の回答

record update without refresh the page can be achieve using long-polling. so 

1) make sure log-polling is working properly on your deployment
2) make sure push notification code working properly when you create a new message on mail.channel 

Note: I am not sure about notification work by default (without any development) on document chatter but I am sure its working fine on Discuss channel (like #general in Domo data)


アバター
破棄
著作者

It's being hosted by Odoo.com right now, so I'm not sure if we can make adjustments to this code?

All other person-to-person chats in Odoo Discuss work normally - if another employee messages, I get a pop up, the mini notification +1 in the top right, and of course the message instantly appears inside the Discuss channel.

It is only the case of messages generated with the above bot script that will not appear until browser refresh

関連投稿 返信 ビュー 活動
2
11月 22
5207
0
11月 21
2152
0
4月 21
4470
2
10月 20
5353
0
3月 20
20072