From 8d2f06750dcf99565e1541476a9fbb22008797e0 Mon Sep 17 00:00:00 2001 From: Jorge Pinna Puissant Date: Fri, 31 Jan 2020 13:59:02 +0000 Subject: [PATCH] [FIX] sale: automatic invoice not send - In an e-commerce with automatic invoice set; - Buy something as public user; - Pay the order; Before this commit, the client don't receive the invoice confirmation email. opw-2176506 closes odoo/odoo#44494 X-original-commit: 684e678e1240f444ccdcd31939456fe57177b5b2 Signed-off-by: Jorge Pinna Puissant (jpp) --- addons/sale/models/payment.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/sale/models/payment.py b/addons/sale/models/payment.py index b47d9e8ec40..59689215508 100644 --- a/addons/sale/models/payment.py +++ b/addons/sale/models/payment.py @@ -3,7 +3,7 @@ import logging import re -from odoo import api, fields, models, _ +from odoo import api, fields, models, _, SUPERUSER_ID from odoo.tools import float_compare @@ -121,7 +121,7 @@ class PaymentTransaction(models.Model): mark_invoice_as_sent=True, company_id=trans.acquirer_id.company_id.id, ) - for invoice in trans.invoice_ids: + for invoice in trans.invoice_ids.with_user(SUPERUSER_ID): invoice.message_post_with_template(int(default_template), email_layout_xmlid="mail.mail_notification_paynow") return res