[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
This commit is contained in:
sergio
2017-01-24 16:50:55 +01:00
committed by Martin Trigaux
parent 333f012e25
commit 28ec23e828
+1 -1
View File
@@ -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,
)