[FIX] account_edi: we forgot to add the edi documents in the mail send wizard
The send and mail wizard was replaced by something simpler, but we forgot to automatically attach the attachments of the edi documents of the old account_edi in the mail. Before, the XML of e.g. the Mexican EDI, generated when the invoice gets sent (and signed) by the government, would not be included automatically when the user wants to send the invoice by mail to the client. Now, it will be. closes odoo/odoo#119435 X-original-commit: b3cbd7ea2b6cc07efd9a6358bd37f23f1ba4e6ab Signed-off-by: Laurent Smet <las@odoo.com>
This commit is contained in:
@@ -2,3 +2,4 @@
|
||||
|
||||
from . import models
|
||||
from . import controller
|
||||
from . import wizard
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
|
||||
from . import account_move_send
|
||||
@@ -0,0 +1,23 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import models
|
||||
|
||||
|
||||
class AccountMoveSend(models.Model):
|
||||
_inherit = 'account.move.send'
|
||||
|
||||
def _get_default_mail_attachments_data(self, mail_template, move):
|
||||
""" Returns all the placeholder data and mail template data
|
||||
"""
|
||||
results = super()._get_default_mail_attachments_data(mail_template, move)
|
||||
|
||||
for doc in move.edi_document_ids:
|
||||
attachment_sudo = doc.sudo().attachment_id
|
||||
if attachment_sudo.res_model and attachment_sudo.res_id:
|
||||
results.append({
|
||||
'id': attachment_sudo.id,
|
||||
'name': attachment_sudo.name,
|
||||
'mimetype': attachment_sudo.mimetype,
|
||||
'placeholder': False,
|
||||
})
|
||||
return results
|
||||
Reference in New Issue
Block a user