reporting-engine/report_context/controllers/main.py

19 lines
732 B
Python
Raw Normal View History

2021-03-23 19:37:36 +00:00
# Copyright 2019 Creu Blanca
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from flectra.addons.web.controllers import main as report
from flectra.http import route, request
import json
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())
return super().report_routes(
reportname, docids=docids, converter=converter, **data)