[IMP] : black, isort, prettier

This commit is contained in:
Kitti U
2021-02-10 00:11:01 +07:00
parent 69ed532279
commit 01f5f982be
9 changed files with 97 additions and 64 deletions

View File

@@ -1,11 +1,14 @@
# Copyright 2020 Creu Blanca
# Copyright 2020 Ecosoft Co., Ltd.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.addons.web.controllers import main as report
from odoo.http import route, request
from werkzeug.urls import url_decode
import json
from werkzeug.urls import url_decode
from odoo.http import request, route
from odoo.addons.web.controllers import main as report
class ReportController(report.ReportController):
@route()
@@ -17,9 +20,9 @@ class ReportController(report.ReportController):
requestcontent = json.loads(data)
url, ttype = requestcontent[0], requestcontent[1]
if (
ttype in ["qweb-pdf"] and
result.headers["Content-Type"] == "application/pdf" and
"?" in url
ttype in ["qweb-pdf"]
and result.headers["Content-Type"] == "application/pdf"
and "?" in url
):
url_data = dict(url_decode(url.split("?")[1]).items())
if "context" in url_data:
@@ -28,6 +31,7 @@ class ReportController(report.ReportController):
Report = request.env["ir.actions.report"]
data = result.get_data()
encrypted_data = Report._encrypt_pdf(
data, context["encrypt_password"])
data, context["encrypt_password"]
)
result.set_data(encrypted_data)
return result