[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) <nle@odoo.com>
This commit is contained in:
Nicolas Lempereur
2019-11-04 13:39:25 +00:00
committed by fw-bot
parent b12bcfbb1b
commit 3f4f570566
+2 -2
View File
@@ -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'])