[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:
parent
333f012e25
commit
28ec23e828
|
@ -395,7 +395,7 @@ class account_invoice(models.Model):
|
||||||
default_model='account.invoice',
|
default_model='account.invoice',
|
||||||
default_res_id=self.id,
|
default_res_id=self.id,
|
||||||
default_use_template=bool(template),
|
default_use_template=bool(template),
|
||||||
default_template_id=template.id,
|
default_template_id=template and template.id or False,
|
||||||
default_composition_mode='comment',
|
default_composition_mode='comment',
|
||||||
mark_invoice_as_sent=True,
|
mark_invoice_as_sent=True,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue