[FIX] event: do not fail if mail.template is missing

Steps to reproduce:

1. Delete the mail.template "Event: Registration Badge".
2. Go to any event.registration record.
3. Click on Send by Mail button.

closes odoo/odoo#93090

X-original-commit: 373a838d2df05b8be9a89a933b291492ba6052f0
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
Ivàn Todorovich
2022-06-08 15:46:08 +02:00
parent 2d36fb5915
commit db45e228a8
+2 -2
View File
@@ -207,13 +207,13 @@ class EventRegistration(models.Model):
message loaded by default
"""
self.ensure_one()
template = self.env.ref('event.event_registration_mail_template_badge')
template = self.env.ref('event.event_registration_mail_template_badge', raise_if_not_found=False)
compose_form = self.env.ref('mail.email_compose_message_wizard_form')
ctx = dict(
default_model='event.registration',
default_res_id=self.id,
default_use_template=bool(template),
default_template_id=template.id,
default_template_id=template and template.id,
default_composition_mode='comment',
default_email_layout_xmlid="mail.mail_notification_light",
)