Skip to content

Commit

Permalink
..
Browse files Browse the repository at this point in the history
  • Loading branch information
rainbow-studio-solution committed Jan 30, 2022
1 parent a610d91 commit a68bee6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions wecom_message/models/mail_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ class MailTemplate(models.Model):
body_json = fields.Text("Json Body", translate=True, default={})
body_markdown = fields.Text("Markdown Body", translate=True,)

use_templates = fields.Boolean("Is template message", default=False)
templates_id = fields.Many2one("wecom.message.template", string="Message template")

msgtype = fields.Selection(
[
("text", "Text message"),
Expand Down Expand Up @@ -391,6 +394,10 @@ def send_message(
"mail.render.mixin"
]._replace_local_links(body_markdown)

if values.get("media_id"):
values["media_id"] = self.media_id.id # 指定对应的素材id
values["use_templates"] = True # 指定使用模板
values["templates_id"] = self.id # 指定对应的模板id
mail = self.env["mail.mail"].sudo().create(values)

# 管理附件
Expand All @@ -406,8 +413,7 @@ def send_message(
if attachment_ids:
mail.write({"attachment_ids": attachment_ids})

if values.get("media_id"):
values["media_id"] = self.media_id.id # 指定对应的素材id
# 指定对应的素材id

# 标识是企微消息
is_wecom_message = False
Expand Down

0 comments on commit a68bee6

Please sign in to comment.