From 1f4c65ef3eaa35144e656581a684f5afdf4a435e Mon Sep 17 00:00:00 2001 From: Jorge Pinna Puissant Date: Thu, 2 Jan 2020 10:39:03 +0000 Subject: [PATCH] [FIX] l10n_it_edi: sent certified email without catchall and bounce Before this commit, when the domain alias was set (e.g. my_domain.com), the reply-to and the reply-path were filled with default values using this domain (e.g. reply-to : catchall@my_domain.com and reply-path: Return-Path: bounce+number@my_domain.com) Now, both are filled with the sender email. Fine-tuning of 66c5053 opw-2127407 opw-2161942 closes odoo/odoo#42619 X-original-commit: 417d69c6ec45310ae22d40adfa70080188a1b1f5 Signed-off-by: Josse Colpaert --- addons/l10n_it_edi/models/account_invoice.py | 2 +- addons/l10n_it_edi/models/ir_mail_server.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/l10n_it_edi/models/account_invoice.py b/addons/l10n_it_edi/models/account_invoice.py index 6a202f0be09..c097d3f4337 100644 --- a/addons/l10n_it_edi/models/account_invoice.py +++ b/addons/l10n_it_edi/models/account_invoice.py @@ -278,7 +278,7 @@ class AccountMove(models.Model): 'attachment_ids': [(6, 0, self.l10n_it_einvoice_id.ids)], }) - mail_fattura = self.env['mail.mail'].sudo().with_context(wo_return_path=True).create({ + mail_fattura = self.env['mail.mail'].sudo().with_context(wo_bounce_return_path=True).create({ 'mail_message_id': message.id, 'email_to': self.env.company.l10n_it_address_recipient_fatturapa, }) diff --git a/addons/l10n_it_edi/models/ir_mail_server.py b/addons/l10n_it_edi/models/ir_mail_server.py index 8df9763f147..03051d8cf4d 100644 --- a/addons/l10n_it_edi/models/ir_mail_server.py +++ b/addons/l10n_it_edi/models/ir_mail_server.py @@ -368,8 +368,8 @@ class IrMailServer(models.Model): attachments=None, message_id=None, references=None, object_id=False, subtype='plain', headers=None, body_alternative=None, subtype_alternative='plain'): - if self.env.context.get('wo_return_path') and headers: - headers.pop('Return-Path', False) + if self.env.context.get('wo_bounce_return_path') and headers: + headers['Return-Path'] = email_from return super(IrMailServer, self).build_email(email_from, email_to, subject, body, email_cc=email_cc, email_bcc=email_bcc, reply_to=reply_to, attachments=attachments, message_id=message_id, references=references, object_id=object_id, subtype=subtype, headers=headers, body_alternative=body_alternative, subtype_alternative=subtype_alternative)