diff --git a/addons/stock/controllers/main.py b/addons/stock/controllers/main.py index 805b9378428..6c1a743391e 100644 --- a/addons/stock/controllers/main.py +++ b/addons/stock/controllers/main.py @@ -4,6 +4,7 @@ from werkzeug.exceptions import InternalServerError from odoo import http from odoo.http import request +from odoo.tools.misc import html_escape import json @@ -33,9 +34,5 @@ class StockReportController(http.Controller): 'message': 'Odoo Server Error', 'data': se } - res = werkzeug.wrappers.Response( - json.dumps(error), - status=500, - headers=[("Content-Type", "application/json")] - ) + res = request.make_response(html_escape(json.dumps(error))) raise InternalServerError(response=res) from e diff --git a/addons/web/controllers/report.py b/addons/web/controllers/report.py index e7001a11c9d..a51384a910d 100644 --- a/addons/web/controllers/report.py +++ b/addons/web/controllers/report.py @@ -12,6 +12,7 @@ from werkzeug.urls import url_parse from odoo import http from odoo.http import content_disposition, request +from odoo.tools.misc import html_escape from odoo.tools.safe_eval import safe_eval, time @@ -143,11 +144,7 @@ class ReportController(http.Controller): 'message': "Odoo Server Error", 'data': se } - res = werkzeug.wrappers.Response( - json.dumps(error), - status=500, - headers=[("Content-Type", "application/json")] - ) + res = request.make_response(html_escape(json.dumps(error))) raise werkzeug.exceptions.InternalServerError(response=res) from e @http.route(['/report/check_wkhtmltopdf'], type='json', auth="user")