Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
5 Відповіді
10859 Переглядів

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

Related Posts Відповіді Переглядів Дія
2
лист. 22
5187
0
лист. 21
2142
0
квіт. 21
4463
2
жовт. 20
5345
0
бер. 20
20066