File tree 1 file changed +13
-1
lines changed
account_invoice_mass_sending/models
1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 1
1
# Copyright 2019 ACSONE SA/NV
2
2
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3
3
4
- from odoo import _ , fields , models
4
+ from odoo import Command , _ , fields , models
5
5
6
6
7
7
class AccountInvoice (models .Model ):
@@ -58,6 +58,7 @@ def _send_invoice_individually(self, template=None):
58
58
"is_email" : True ,
59
59
"template_id" : template .id ,
60
60
"composition_mode" : "comment" ,
61
+ "attachment_ids" : [Command .set (self ._get_edi_documents ())],
61
62
}
62
63
)
63
64
wiz .onchange_template_id ()
@@ -67,3 +68,14 @@ def _send_invoice_individually(self, template=None):
67
68
}
68
69
)
69
70
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
You can’t perform that action at this time.
0 commit comments