Skip to Content
मेन्यू
This question has been flagged
1 Reply
1677 Views

Hey guys,


Googling around, I see that similar problems have existed for a century (since at least Odoo 10), but perhaps the root causes are unrelated.


The problem:

When creating a new mail.message with model mail.channel through the API, it doesn't appear on screen until you refresh the page. This obviously renders any use of notifications null. My assumption is that the database entry is created but it isn't queried until a new request is made by the client (maybe I'm wrong, whatever). Normal chat works just fine. This is self-hosted Odoo 16, with an nginx ssl proxy inbetween. It's setup according to the documentation, where /websocket goes to the gevent port while everything else goes to the normal port, but playing around (moving everything to the normal port, or the longpolling port) doesn't make any difference.


What can I do to circumvent this? I'd like 'Discuss' to work more akin to Slack, but at the moment this is completely unusable. 

Avatar
Discard
Author

Still unresolved, bumping this to see if anyone has any input. Thanks!

Best Answer

Hi Egor,

I was struggling with this as well but I found a solution so I thought I share it here if anyone needs it. You first need to create a message like you did before, and then you need to create a bus.bus entry. I created an extra security group with read and write permissions for that user. Here is an example of the creation of the bus entry:

"channel": ["xxxx.odoodomain.com","discuss.channel","6"],	
"message": ​{
        "type": "discuss.channel/new_message",
        "payload": {
            "data": {
                "mail.message": [
                    {
                        "attachment_ids": [],
                        "author": {
                            "id": 35,
                            "type": "partner"
                        },
                        "body": "<p>I'm sorry, but it seems like your message is unclear. Could you please provide more details or clarify what you need help with?</p>",
                        "create_date": "2025-02-09T19:30:46.738Z",
                        "date": "2025-02-09T19:30:46.739Z",
                        "default_subject": "XXXXX, Administrator",
                        "email_from": "\"XXXXX\" <bot@XXXX.com>",
                        "id": 360,
                        "is_discussion": true,
                        "is_note": false,
                        "linkPreviews": [],
                        "message_type": "comment",
                        "model": "discuss.channel",
                        "notifications": [],
                        "parentMessage": false,
                        "pinned_at": false,
                        "rating_id": false,
                        "reactions": [],
                        "recipients": [],
                        "record_name": "XXXXXX, Administrator",
                        "res_id": "6",
                        "scheduledDatetime": false,
                        "subject": false,
                        "subtype_description": false,
                        "thread": {
                            "id": 6,
                            "model": "discuss.channel"
                        },
                        "write_date": "2025-02-09T19:30:46.740Z"
                    }
                ],
                "mail.thread": [
                    {
                        "id": 6,
                        "model": "discuss.channel",
                        "module_icon": "/mail/static/description/icon.png",
                        "rating_avg": 0.0,
                        "rating_count": 0
                    }
                ],
                "res.partner": [
                    {
                        "avatar_128_access_token": "f8ff628a09c9169216e839b77c105d2794baed72846d10c8b2a46e4f3f744402o0x67cc5689",
                        "id": 35,
                        "isInternalUser": true,
                        "is_company": false,
                        "name": "XXXXXX",
                        "userId": 7,
                        "write_date": "2025-02-09T19:30:46.740Z"
                    }
                ]
            },
            "id": 6,
            "temporary_id": 360.29021055706145105
        }
    }
Avatar
Discard