[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) <tbe@odoo.com>
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
This commit is contained in:
Martin Trigaux
2021-11-26 20:37:46 +00:00
parent 4a1a912c88
commit cd464d84d7
+2 -2
View File
@@ -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,),