From 9d69d6d056b60e0bef838e5a857e2ba12b45810d Mon Sep 17 00:00:00 2001 From: "Andrea Grazioso (agr-odoo)" Date: Tue, 11 Jul 2023 10:47:33 +0000 Subject: [PATCH] [FIX] account_edi,l10n_it_edi: missing edi xml attachment With an mx company setup Create Invoice Validate CFDI Click "Send & Print" Issue: xml not in attachments In e9e9081 FW-port for saas-16.3 `_get_default_email_attachment_data` method was removed opw-3419746 closes odoo/odoo#129414 X-original-commit: 1001f6b5c007360ad2ecd5408cad78a744bf3d36 Signed-off-by: Laurent Smet (las) Signed-off-by: Andrea Grazioso (agr) --- .../account_edi/wizard/account_move_send.py | 19 +++++++------------ .../l10n_it_edi/wizard/account_move_send.py | 2 +- 2 files changed, 8 insertions(+), 13 deletions(-) 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)