Skip to content

Commit f09b79c

Browse files
committed
[IMP] account_invoice_mass_sending: Add EDI documents to mass sending email
1 parent 24d2441 commit f09b79c

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

account_invoice_mass_sending/models/account_move.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright 2019 ACSONE SA/NV
22
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
33

4-
from odoo import _, fields, models
4+
from odoo import Command, _, fields, models
55

66

77
class AccountInvoice(models.Model):
@@ -58,6 +58,7 @@ def _send_invoice_individually(self, template=None):
5858
"is_email": True,
5959
"template_id": template.id,
6060
"composition_mode": "comment",
61+
"attachment_ids": [Command.set(self._get_edi_documents())],
6162
}
6263
)
6364
wiz.onchange_template_id()
@@ -67,3 +68,14 @@ def _send_invoice_individually(self, template=None):
6768
}
6869
)
6970
return wiz.send_and_print_action()
71+
72+
def _get_edi_documents(self):
73+
self.ensure_one()
74+
attachment_ids = []
75+
if getattr(self, "edi_document_ids", False):
76+
for edi in self.edi_document_ids:
77+
if self._get_edi_attachment(edi.edi_format_id):
78+
attachment_ids.append(
79+
self._get_edi_attachment(edi.edi_format_id).id
80+
)
81+
return attachment_ids

0 commit comments

Comments
 (0)