[IMP] report_context: black, isort, prettier

This commit is contained in:
Jaime Arroyo
2020-09-30 12:06:33 +02:00
committed by Pierrick Brun
parent 5a12000272
commit 4d8f393d1e
7 changed files with 77 additions and 72 deletions

View File

@@ -1,18 +1,20 @@
# Copyright 2019 Creu Blanca
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo.addons.web.controllers import main as report
from odoo.http import route, request
import json
from odoo.http import request, route
from odoo.addons.web.controllers import main as report
class ReportController(report.ReportController):
@route()
def report_routes(self, reportname, docids=None, converter=None, **data):
report = request.env['ir.actions.report']._get_report_from_name(
reportname)
original_context = json.loads(data.get('context', '{}'))
data['context'] = json.dumps(report.with_context(
original_context
)._get_context())
report = request.env["ir.actions.report"]._get_report_from_name(reportname)
original_context = json.loads(data.get("context", "{}"))
data["context"] = json.dumps(
report.with_context(original_context)._get_context()
)
return super().report_routes(
reportname, docids=docids, converter=converter, **data)
reportname, docids=docids, converter=converter, **data
)