diff --git a/addons/account_edi/wizard/account_move_send.py b/addons/account_edi/wizard/account_move_send.py index 3d389f23e4a..1b7f539fedd 100644 --- a/addons/account_edi/wizard/account_move_send.py +++ b/addons/account_edi/wizard/account_move_send.py @@ -9,18 +9,13 @@ class AccountMoveSend(models.Model): def _get_mail_attachment_from_doc(self, doc): attachment_sudo = doc.sudo().attachment_id if attachment_sudo.res_model and attachment_sudo.res_id: - return [{ - 'id': attachment_sudo.id, - 'name': attachment_sudo.name, - 'mimetype': attachment_sudo.mimetype, - 'placeholder': False, - }] - return [] + return attachment_sudo + return self.env['ir.attachment'] - def _get_default_email_attachment_data(self, mail_template, move): - """ Returns all the placeholder data and mail template data + def _get_invoice_extra_attachments(self, move): + """ Returns extra edi attachments """ - results = super()._get_default_email_attachment_data(mail_template, move) + result = super()._get_invoice_extra_attachments(move) for doc in move.edi_document_ids: - results += self._get_mail_attachment_from_doc(doc) - return results + result += self._get_mail_attachment_from_doc(doc) + return result diff --git a/addons/l10n_it_edi/wizard/account_move_send.py b/addons/l10n_it_edi/wizard/account_move_send.py index 31076ba4662..d77ea9cef8a 100644 --- a/addons/l10n_it_edi/wizard/account_move_send.py +++ b/addons/l10n_it_edi/wizard/account_move_send.py @@ -8,5 +8,5 @@ class AccountMoveSend(models.Model): def _get_mail_attachment_from_doc(self, doc): if doc.edi_format_id.code == 'fattura_pa': - return [] + return self.env['ir.attachment'] return super()._get_mail_attachment_from_doc(doc)