mirror of
https://github.com/OCA/reporting-engine.git
synced 2025-02-16 16:30:38 +02:00
[FIX] report_xlsx: fix generation of pdf reports
the report handler for xlsx added over here is always returning `true` even if the report being
generated is not xlsx. Due to this, the report handler doesn't check for other report types
at b309d3a99f/addons/web/static/src/webclient/actions/action_service.js (L1019)
and thus doesn't generate any other reports. So if the converter is not xlsx, return false instead of true.
Also, updating the docids and context in the report_routes controller only needs to be done if
the converter is xlsx and not in any other case.
This commit is contained in:
committed by
Dario Del Zozzo
parent
20b8add35e
commit
e7c3e9007b
@@ -24,16 +24,16 @@ _logger = logging.getLogger(__name__)
|
||||
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)
|
||||
context = dict(request.env.context)
|
||||
if docids:
|
||||
docids = [int(i) for i in docids.split(",")]
|
||||
if data.get("options"):
|
||||
data.update(json.loads(data.pop("options")))
|
||||
if data.get("context"):
|
||||
data["context"] = json.loads(data["context"])
|
||||
context.update(data["context"])
|
||||
if converter == "xlsx":
|
||||
report = request.env["ir.actions.report"]._get_report_from_name(reportname)
|
||||
context = dict(request.env.context)
|
||||
if docids:
|
||||
docids = [int(i) for i in docids.split(",")]
|
||||
if data.get("options"):
|
||||
data.update(json.loads(data.pop("options")))
|
||||
if data.get("context"):
|
||||
data["context"] = json.loads(data["context"])
|
||||
context.update(data["context"])
|
||||
xlsx = report.with_context(**context)._render_xlsx(docids, data=data)[0]
|
||||
xlsxhttpheaders = [
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user