如何在 author_id 中设置 'email' inherit mail.thread on Odoo
How to set 'email' in author_id inherit mail.thread on Odoo
我在 Odoo12
上继承 mail.thread
_inherit = ['mail.thread', 'mail.activity.mixin']
并发布消息:
msg = 'message test.'
self.message_post(body=msg, email_from='Otro <otro@otro.com>', subtype='mail.mt_comment',)
image
这些消息是用管理员用户添加的。如何将发送邮件的外部用户的邮件放在 author_id
?
字段中
试用self.message_post(body=msg, email_from='Otro <otro@otro.com>', subtype='mail.mt_comment', author_id=False)
author_id=False
将告诉 Odoo 使用 email_from
作为作者。
我发现 "trick" 在这里:
author_id = kwargs.get('author_id')
if author_id is None: # keep False values
author_id = self.env['mail.message']._get_default_author().id
半有价值的评论# keep False values
解开了大秘密;-)
None
将使用当前环境的用户。
我在 Odoo12
上继承mail.thread
_inherit = ['mail.thread', 'mail.activity.mixin']
并发布消息:
msg = 'message test.'
self.message_post(body=msg, email_from='Otro <otro@otro.com>', subtype='mail.mt_comment',)
image
这些消息是用管理员用户添加的。如何将发送邮件的外部用户的邮件放在 author_id
?
试用self.message_post(body=msg, email_from='Otro <otro@otro.com>', subtype='mail.mt_comment', author_id=False)
author_id=False
将告诉 Odoo 使用 email_from
作为作者。
我发现 "trick" 在这里:
author_id = kwargs.get('author_id')
if author_id is None: # keep False values
author_id = self.env['mail.message']._get_default_author().id
半有价值的评论# keep False values
解开了大秘密;-)
None
将使用当前环境的用户。