ODOO 15通知导航返回任务/记录
我正在尝试向用户A发送通知,然后用户B批准了一项任务。 (但是使用odoobot用户)
notification_ids = [(0,0,{'res_partner_id':user_id.partner_id.id,'notification_type':'inbox'})]
self.sudo().message_post(subject=summary,body=summary_link,message_type='notification, subtype_xmlid='mail.mt_comment', author_id=odoo_bot_id.partner_id.id, notification_ids=notification_ids)
它正在工作,但现在我要这样做:
valueError:在业务文档上发布消息。使用Message_notify向用户发送通知。
if self._name == 'mail.thread' or not self.id or message_type == 'user_notification':
raise ValueError(_('Posting a message should be done on a business document. Use message_notify to send a notification to an user.'))
不是self.id
是什么意思
,我应该使用
message_notify_ids = [user_id.partner_id.id]
record.sudo().message_notify(partner_ids=message_notify_ids, parent_id=odoo_bot_id.partner_id.id, author_id=odoo_bot_id.partner_id.id, body=summary_link, subject=summary)
以下显示弹出通知,但没有在索引中显示,以便用户可以导航到任务
I am trying to send notification to user A then user B Approves a task. (but using the odoobot user)
notification_ids = [(0,0,{'res_partner_id':user_id.partner_id.id,'notification_type':'inbox'})]
self.sudo().message_post(subject=summary,body=summary_link,message_type='notification, subtype_xmlid='mail.mt_comment', author_id=odoo_bot_id.partner_id.id, notification_ids=notification_ids)
it was working but now i am going this:
ValueError: Posting a message should be done on a business document. Use message_notify to send a notification to an user.
if self._name == 'mail.thread' or not self.id or message_type == 'user_notification':
raise ValueError(_('Posting a message should be done on a business document. Use message_notify to send a notification to an user.'))
what does not self.id
mean
according to this I should use
message_notify_ids = [user_id.partner_id.id]
record.sudo().message_notify(partner_ids=message_notify_ids, parent_id=odoo_bot_id.partner_id.id, author_id=odoo_bot_id.partner_id.id, body=summary_link, subject=summary)
this shows the popup notification but does not show in the index so the user can navigate to the task
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当我记录
self.id
时,我得到了newID_26404
,这是一个临时ID,因为该函数是在计算中运行的。修复
说明:丢弃更改确实在我的情况下发送了通知,因此最好将其添加到写功能中,
如果有更好的解决方案感谢,我对建议开放。
When I logged
self.id
I gotNewId_26404
which is a temp id since the function was run in a compute.Fix
Note: discarding the changes did send the notification in my case, so it maybe better to add it in write function
I am open to suggestions if there is a better solution thank.