콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
5 답글
10829 화면

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
5177
0
11월 21
2133
0
4월 21
4459
2
10월 20
5332
0
3월 20
20064