From 3f4f5705662848ed0e00d608377482ff836e4b68 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Mon, 4 Nov 2019 11:07:12 +0000 Subject: [PATCH] [FIX] website_sale: send extra step as public user The extra informations not on the sale.order models were sent before 13.0 with the superuser user. In 13.0 with the change of `sudo` and `with_user` behavior, we were now in superuser mode but not with the superuser so the mail would error (no from address) and the sale order would error. With this changeset, we get back to the pre-13 behavior. opw-2116346 closes #39730 closes odoo/odoo#39748 X-original-commit: 7b1654a10f5a005677492ec71e6fa1e54df09ae2 Signed-off-by: Nicolas Lempereur (nle) --- addons/website_sale/controllers/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/website_sale/controllers/main.py b/addons/website_sale/controllers/main.py index faeb1b314d7..435ff2ce5d2 100644 --- a/addons/website_sale/controllers/main.py +++ b/addons/website_sale/controllers/main.py @@ -5,7 +5,7 @@ import logging from datetime import datetime from werkzeug.exceptions import Forbidden, NotFound -from odoo import fields, http, tools, _ +from odoo import fields, http, SUPERUSER_ID, tools, _ from odoo.http import request from odoo.addons.base.models.ir_qweb_fields import nl2br from odoo.addons.http_routing.models.ir_http import slug @@ -110,7 +110,7 @@ class WebsiteSaleForm(WebsiteForm): 'no_auto_thread': False, 'res_id': order.id, } - request.env['mail.message'].sudo().create(values) + request.env['mail.message'].with_user(SUPERUSER_ID).create(values) if data['attachments']: self.insert_attachment(model_record, order.id, data['attachments'])