[FIX] mail_debrand: avoid KeyError: 'body_html' on plain text emails
This commit is contained in:
parent
f6159689b2
commit
158cccfce7
@ -101,7 +101,9 @@ class MailMail(models.AbstractModel):
|
||||
values_list[index]["body_html"] = self.env[
|
||||
"mail.render.mixin"
|
||||
].remove_href_odoo(
|
||||
values_list[index]["body_html"], remove_parent=0, remove_before=1
|
||||
values_list[index].get("body_html", ""),
|
||||
remove_parent=0,
|
||||
remove_before=1,
|
||||
)
|
||||
|
||||
return super().create(values_list)
|
||||
|
@ -54,3 +54,14 @@ class TestMailDebrand(common.TransactionCase):
|
||||
._render_template(paynow_arch, "ir.ui.view", [self.paynow_template])
|
||||
)
|
||||
self.assertNotIn("Aangeboden door", res)
|
||||
|
||||
def test_plaintext_email(self):
|
||||
MailMessage = self.env["mail.mail"]
|
||||
email_values = {
|
||||
"email_from": "customer@example.com",
|
||||
"subject": "Hello",
|
||||
"email_to": "contact@example.com",
|
||||
"reply_to": "contact@example.com",
|
||||
}
|
||||
# No exception expected
|
||||
MailMessage.create(email_values)
|
||||
|
Loading…
Reference in New Issue
Block a user