Allow to send email without files to attach

Closes #12645
This commit is contained in:
Maxime Richez
2023-10-16 16:48:40 +02:00
parent 2d88ad118c
commit 9394d64c2a
+6 -5
View File
@@ -189,11 +189,12 @@ class Email(ResourceAccessMixin, ModelSQL, ModelView):
body=body,
resource=record)
email.save()
attachments_ = []
for name, data in files:
attachments_.append(
Attachment(resource=email, name=name, data=data))
Attachment.save(attachments_)
if files:
attachments_ = []
for name, data in files:
attachments_.append(
Attachment(resource=email, name=name, data=data))
Attachment.save(attachments_)
return email
@classmethod