Enable Dark Mode!
By: Cirin C Baby

How to Post a Message in Chatter? | Odoo 12

Technical Odoo 12 Sales

Be it Sales, Purchase, Inventory, Invoice or any other, Chatter is one element that is commonly seen in all of these modules. Chatter comes as a significant feature in Odoo, facilitating real-time communication.

Basically, the chatter helps with internal communication. For instance, when a state-changing happens, say one of the sale orders gets moved from quotation state to sale state, you can visible the chatter message as “state quotation -> sale". So the user or administrator can easily identify the current stage of the sale order. So today am going to show you how to post a chatter message in odoo


In odoo, there is a default function named “message_ post” and this is used for message post on chatter as well as sending emails.

There are many arguments that are used in message posts. The lists include body, subtype, subject,attachment_ids, message_type, partner_ids, author_id, email_from and so on. These are the arguments of the message_post function.

Let’s see the simple way to add a message in chatter using the argument ‘body’.

So, here with the help of an example, I will show you how to post a message when a product finds missing while it’s being picked.


In the above screenshot, I am creating one sale order. Here, the delivery method is selected as 2 steps.

So while picking the products from the warehouse, if the product is found missing (quantity done = 0) that will be shown on the chatter with the help of message_post.

Class StockPicking(models.Model):
    _inherit = "stock.picking"
    def button_validate(self):
        res = super(StockPicking,self).button_validate()
        for pick in self:
            warehouse_id = pick.picking_type_id.warehouse_id
            if warehouse_id and warehouse_id.delivery_steps == 'pick_ship':
                for move in pick.move_ids_without_package:
                    if move.product_uom_qty != move.quantity_done:
                        sale_order = self.env[
                        for sl_order in sale_order:
                            if sl_order.name == pick.origin:
                                sale_order = sl_order
                                responsible_person = sale_order.user_id.name
                        display_msg  = """ Dear """ + responsible + """,
                                       Please find the delivery deviation from 
                                       the """ + sale_order.name + """
                                       <b>Missing Products:</b>
                        for prod in move: 
                            if prod.quantity_done == 0:
                                prod_id = self.env[
                                display_msg += """ - """
                                display_msg += str(prod_id.id.name)
                                display_msg += """ <br/> """
        return res
display_msg = """Dear """ + responsible_person + """,
               Please find the delivery deviation from 
               the """ + sale_order.name + """
               <b>Missing Products:</b>
The above lines will be posted to chatter when the product is found missing. So inside display_msg “responsible_person” will be the current sale person and the “sale_order.name” will be the sale order name.


Here, the product Office Lamp done quantity is zero. If done quantity becomes zero that means the product is not picked while validating this picking,  it will post the display message with the help of message_post(body=display_msg).

The below screenshot shows the missing product in Chatter.


This is how we post a message in chatter.

If you need any assistance in odoo, we are online, please chat with us.


Leave a comment




Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635



Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.



Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message