From cd464d84d7a6656f04e0779aa2215a7c223ec1a7 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 26 Nov 2021 15:30:03 +0000 Subject: [PATCH] [FIX] sale: render the report as superuser Same as 5dde19c92ecee, sudo is not enough but the report needs to be rendered with the user 1. The access token proves the user has the access, the fact that he is a portal, employee or public should not change the result closes odoo/odoo#80491 X-original-commit: 66ab2ae213f05b055a032d0810de1de9334741ac Signed-off-by: Toufik Benjaa (tbe) Signed-off-by: Martin Trigaux (mat) --- addons/sale/controllers/portal.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/sale/controllers/portal.py b/addons/sale/controllers/portal.py index 716ef4006e3..6b2639e38a2 100644 --- a/addons/sale/controllers/portal.py +++ b/addons/sale/controllers/portal.py @@ -3,7 +3,7 @@ import binascii -from odoo import fields, http, _ +from odoo import fields, http, SUPERUSER_ID, _ from odoo.exceptions import AccessError, MissingError, ValidationError from odoo.fields import Command from odoo.http import request @@ -256,7 +256,7 @@ class CustomerPortal(portal.CustomerPortal): order_sudo.action_confirm() order_sudo._send_order_confirmation_mail() - pdf = request.env.ref('sale.action_report_saleorder').sudo()._render_qweb_pdf([order_sudo.id])[0] + pdf = request.env.ref('sale.action_report_saleorder').with_user(SUPERUSER_ID)._render_qweb_pdf([order_sudo.id])[0] _message_post_helper( 'sale.order', order_sudo.id, _('Order signed by %s') % (name,),