From 28ec23e828139516db3a0f7ef223e4ee13bdd110 Mon Sep 17 00:00:00 2001 From: sergio Date: Tue, 24 Jan 2017 15:12:24 +0100 Subject: [PATCH] [FIX] account: fallback on missing template template contains the mail template to render and is the result of the call to `self.env.ref('account.email_template_edi_invoice', False)` If the template does not exists (deleted), template is `None` and the action rendering crashes. While it is not recommended to delete master data, it is still possible to use custom mail templates. Closes #15204 --- addons/account/account_invoice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index 9f4ee6c7811..2e48a12f70d 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -395,7 +395,7 @@ class account_invoice(models.Model): default_model='account.invoice', default_res_id=self.id, default_use_template=bool(template), - default_template_id=template.id, + default_template_id=template and template.id or False, default_composition_mode='comment', mark_invoice_as_sent=True, )