record.message_post(body="此记录已被标记为重要。")return { 'type': 'ir.actions.client','tag': 'reload',} 在此代码中,我们创建了一个 important 字段,并定义了 action_mark_as_important 函数,该函数将记录标记为重要并在聊天窗口中发布消息。步骤 4:将字段添加到视图中 为了确保新字段成为表单视图...
步骤4,message_post_with_template()方法用于发送邮件模板。该方法是通过继承模型mail.thread实现的。为了发送邮件,我们需要将模板的ID作为参数传递给函数。 更多 message_post_with_tempalte()函数用于发送Jinja格式的邮件。如果我们想发送纯文本的邮件,可如下: self.message_post(body="Please return your book on t...
message= _("Hello,Odoo's chat helps employees collaborate efficiently. I'm here to help you discover its features.Try to send me an emoji :)") channel.sudo().message_post(body=message, author_id=odoobot_id, message_type="comment", subtype_xmlid="mail.mt_comment") self.env.user.odoo...
message_post(self, body='', subject=None, message_type='notification',subtype=None, parent_id=False, attachments=None, content_subtype='html',**kwargs) 在现有主题上发布一个新消息,返回新的mail.message的ID。 参数 body(str) – 消息的正文,通常为将需要清理的原始HTML message_type(str) – 查看...
record.message_post( body="此记录已被标记为重要。") return { 'type': 'ir.actions.client', 'tag': 'reload', } 在此代码中,我们创建了一个 important 字段,并定义了 action_mark_as_important 函数,该函数将记录标记为重要并在聊天窗口中发布消息。
message_post_with_template()方法用于通过Jinja模板发送邮件。如果只是想要通过普通文本发送邮件,可以使用message_post()方法: self.message_post(body="Please return your book on time") 以上的代码会在聊天器中添加一条Please return your book on time 的消息。所有的关注者会收到这条通知消息。如果只是想要记...
self.message_post('Hello!') 1. 这会添加一个普通文本消息,但不会向follower发送通知。这是因为默认由mail.mt_note子类型发送消息。但我们可以通过指定的子类型来发送消息。要添加一条向follower发送通知的消息,应使用mt_comment子类型。另一个可选属性是消息标题,使用这两项的示例如下: ...
问状态改变的message_post odooENdef name_get(self): # Prefetch the fields used by the `nam...
self.message_post(cr, uid, ids, body=_("Order %s confirmed. Please Send Material") % self._description, context=context) 1. 2. 修改结果 rewrite_function.png 优点: 简单直接 缺点: 需要找到代码函数,重写函数。 定制,根据状态变化 此方法需要修改代码,在单据状态变化的时候,自动推送消息。
applicant.job_id.message_post( body=_( 'New Employee %s Hired') % applicant.partner_nameifapplicant.partner_nameelseapplicant.name, subtype="hr_recruitment.mt_job_applicant_hired") applicant.message_post_with_view( 'hr_recruitment.applicant_hired_template', ...