mirror of
https://github.com/OCA/reporting-engine.git
synced 2025-02-16 16:30:38 +02:00
[ADD] reporting-context
This commit is contained in:
committed by
Pierrick Brun
parent
9f6c1c20e3
commit
fb0efed1b8
18
report_context/controllers/main.py
Normal file
18
report_context/controllers/main.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# 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
|
||||
|
||||
|
||||
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)
|
||||
Reference in New Issue
Block a user