[FIX] mail: avoid cache miss when opening the template previewer

Sometimes the previewer crashes in rendering with cache-based records, hence
trying to check directly the id of the related reference record.

Task-2710804 (Mail: Clean MailThread Posting API)

Part-of: odoo/odoo#99482
This commit is contained in:
Thibault Delavallée
2023-01-17 20:58:30 +01:00
parent 11906b776e
commit 44a316275d
+1 -1
View File
@@ -72,7 +72,7 @@ class MailTemplatePreview(models.TransientModel):
copy_depends_values = {'lang': self.lang}
mail_template = self.mail_template_id.with_context(lang=self.lang)
try:
if not self.resource_ref:
if not self.resource_ref.id:
self._set_mail_attributes()
else:
copy_depends_values['resource_ref'] = '%s,%s' % (self.resource_ref._name, self.resource_ref.id)