Search code examples
odooqweb

Odoo adding messages in oe_chatter


I'm developing in Odoo Qweb and I need to add some messages in oe_chatter box when some events are thrown. Those messages had to be written in the next class: "calendar_event". Those are the records for written the messages:

@http.route('/events_accept/all/<int:meeting_id>', type='http', auth="user",website=True)
def meetings(self,meeting_id=None):
 event = request.env['calendar.event'].search([('id', '=', meeting_id)])
 msg_body = "....."
 #Write messages in oe_chatter 

Anyone knows how to do this task?

Thanks for reading!


Solution

  • Should be enough to call message_post() on calendar.event recordsets.

    event = request.env['calendar.event'].search([('id', '=', meeting_id)])
    msg_body = "....."
    event.message_post(body=msg_body)
    

    If you want to use subtypes or other features of chatter messages look into message_post() to understand its possibilities.