Messages / Discussions / Log
Any Odoo model that inherits from mail.thread can call the message_post method.
This feature is particularly useful for:
Logging internal notes or system messages on a document.
Enabling chatter-style communication directly linked to a specific record.
By leveraging message_post, you can keep discussions, logs, and notifications tied to the relevant document, improving traceability and collaboration.
Post a Message to Document
{
"id": "839dj3ud9829302jd",
"action": "call_method",
"model_id": "account.move",
"keyword": {
"body": "please re-check again on line 1", // the text of the message goes here
"context": {
"allowed_company_ids": [
1
],
"default_company_id": 1,
"tz": "Asia/Singapore"
}
},
"params": [
[40] // the document id
],
"fn_name": "message_post",
"odoo_instance": {
"url": "YOUR_ODOO_INSTANCE_URL",
"user_id": INT(YOUR_USER_ID),
"db": "YOUR_ODOO_DB",
"api_key": "YOUR_ODOO_API_KEY"
}
}Fetching Messages
All chatter messages are referenced in the message_ids field on the corresponding document.
To retrieve all messages for a given record:
Fetch the document, making sure to include the message_ids field.
Use the array of IDs returned in message_ids to query the mail.message model.
This two-step process allows you to access the complete set of messages (notes, emails, or logs) linked to the document.
Last updated