From 450f9f58acd8da33b4368ee0c281b7f0c9986c08 Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Fri, 13 Oct 2023 12:22:30 +0200 Subject: [PATCH] [FIX] mail: _track_post_template_finalize() is broken when the record no longer exists Part-of: odoo/odoo#138019 --- addons/mail/models/mail_thread.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py index 27b0d11badd..145c5e98193 100644 --- a/addons/mail/models/mail_thread.py +++ b/addons/mail/models/mail_thread.py @@ -657,7 +657,13 @@ class MailThread(models.AbstractModel): # leading to a traceback in case the related message_id # doesn't exist cleaned_self = self.with_context(clean_context(self._context))._fallback_lang() - templates = self._track_template(changes) + try: + templates = self._track_template(changes) + except MissingError: + if not self.exists(): + return + raise + default_composition_mode = 'mass_mail' if len(self) != 1 else 'comment' for _field_name, (template, post_kwargs) in templates.items(): if not template: