odoo - 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!
解决方案
应该足以调用message_post()
记录calendar.event
集。
event = request.env['calendar.event'].search([('id', '=', meeting_id)])
msg_body = "....."
event.message_post(body=msg_body)
如果您想使用聊天消息的子类型或其他功能,请查看message_post()
以了解其可能性。
推荐阅读
- html - 上传到服务器后,HTML 网站找不到我的 PNG 图像
- php - 使用 Xampp 找不到对象
- tensorflow - 如何计算CNN模型训练过程的总运行时间
- javascript - 与本地 SQL Server 实例的直接 HTML/JS 连接
- rest - API 令牌认证 - 安全问题
- javascript - 如何使用隐式授权流获取应用程序请求授权
- javascript - 如何使这个多幻灯片面板无限循环
- django - 最终部署的 Django 错误未找到 url
- javascript - 输入特定文本后显示消息
- java - Java - 返回一个新数组,其中元素位于给定数组的偶数位置