[FIX] account_edi: fix crash when sending an invoice with an edi that has an error
- When an edi.document has an error and thus does not have an attachment, trying to send the invoice by mail would cause a crash closes odoo/odoo#56450 X-original-commit: 7f9e34a5b11772af958293cd75d30cae69151497 Signed-off-by: Laurent Smet <smetl@users.noreply.github.com> Signed-off-by: bfr-o <bfr-o@users.noreply.github.com>
This commit is contained in:
@@ -28,7 +28,8 @@ class MailTemplate(models.Model):
|
||||
continue
|
||||
|
||||
attachment = doc.attachment_id
|
||||
record_data.setdefault('attachments', [])
|
||||
record_data['attachments'].append((attachment.name, attachment.datas))
|
||||
if attachment:
|
||||
record_data.setdefault('attachments', [])
|
||||
record_data['attachments'].append((attachment.name, attachment.datas))
|
||||
|
||||
return res
|
||||
|
||||
Reference in New Issue
Block a user