diff --git a/addons/website_form/controllers/main.py b/addons/website_form/controllers/main.py index e80dd1ffe07..81d7cf363fa 100644 --- a/addons/website_form/controllers/main.py +++ b/addons/website_form/controllers/main.py @@ -8,7 +8,7 @@ import pytz from datetime import datetime from psycopg2 import IntegrityError -from odoo import http +from odoo import http, SUPERUSER_ID from odoo.http import request from odoo.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT from odoo.tools.translate import _ @@ -236,7 +236,7 @@ class WebsiteForm(http.Controller): 'res_id': id_record, 'attachment_ids': [(6, 0, orphan_attachment_ids)], } - mail_id = request.env['mail.message'].sudo().create(values) + mail_id = request.env['mail.message'].with_user(SUPERUSER_ID).create(values) else: # If the model is mail.mail then we have no other choice but to # attach the custom binary field files on the attachment_ids field.