mirror of
https://gitlab.com/flectra-community/reporting-engine.git
synced 2024-11-14 18:22:04 +00:00
Automatic Update form OCA2FC Migrator
This commit is contained in:
parent
66a1461840
commit
5fca8ad26f
@ -1,4 +1,4 @@
|
|||||||
# Flectra Community / Flectra 2.0 / reporting-engine
|
# Flectra Community / reporting-engine
|
||||||
|
|
||||||
None
|
None
|
||||||
|
|
||||||
@ -11,7 +11,7 @@ addon | version | summary
|
|||||||
--- | --- | ---
|
--- | --- | ---
|
||||||
[report_qweb_encrypt](report_qweb_encrypt/) | 2.0.1.0.0| Allow to encrypt qweb pdfs
|
[report_qweb_encrypt](report_qweb_encrypt/) | 2.0.1.0.0| Allow to encrypt qweb pdfs
|
||||||
[report_xlsx_helper](report_xlsx_helper/) | 2.0.1.0.0| Report xlsx helpers
|
[report_xlsx_helper](report_xlsx_helper/) | 2.0.1.0.0| Report xlsx helpers
|
||||||
[report_xml](report_xml/) | 2.0.1.0.0| Allow to generate XML reports
|
[report_xml](report_xml/) | 2.0.1.0.1| Allow to generate XML reports
|
||||||
[report_qweb_pdf_watermark](report_qweb_pdf_watermark/) | 2.0.1.0.0| Add watermarks to your QWEB PDF reports
|
[report_qweb_pdf_watermark](report_qweb_pdf_watermark/) | 2.0.1.0.0| Add watermarks to your QWEB PDF reports
|
||||||
[report_xlsx_helper_demo](report_xlsx_helper_demo/) | 2.0.1.0.0| Report xlsx helpers - demo
|
[report_xlsx_helper_demo](report_xlsx_helper_demo/) | 2.0.1.0.0| Report xlsx helpers - demo
|
||||||
[base_comment_template](base_comment_template/) | 2.0.2.0.1| Add conditional mako template to any reporton models that inherits comment.template.
|
[base_comment_template](base_comment_template/) | 2.0.2.0.1| Add conditional mako template to any reporton models that inherits comment.template.
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# License AGPL-3.0 or later (https://www.gnuorg/licenses/agpl.html).
|
# License AGPL-3.0 or later (https://www.gnuorg/licenses/agpl.html).
|
||||||
{
|
{
|
||||||
"name": "XML Reports",
|
"name": "XML Reports",
|
||||||
"version": "2.0.1.0.0",
|
"version": "2.0.1.0.1",
|
||||||
"category": "Reporting",
|
"category": "Reporting",
|
||||||
"website": "https://gitlab.com/flectra-community/reporting-engine",
|
"website": "https://gitlab.com/flectra-community/reporting-engine",
|
||||||
"author": "Tecnativa, Odoo Community Association (OCA), Avoin.Systems",
|
"author": "Tecnativa, Odoo Community Association (OCA), Avoin.Systems",
|
||||||
|
@ -6,7 +6,8 @@ import json
|
|||||||
from werkzeug.urls import url_decode
|
from werkzeug.urls import url_decode
|
||||||
|
|
||||||
from flectra.http import content_disposition, request, route, serialize_exception
|
from flectra.http import content_disposition, request, route, serialize_exception
|
||||||
from flectra.tools import html_escape, safe_eval
|
from flectra.tools import html_escape
|
||||||
|
from flectra.tools.safe_eval import safe_eval, time
|
||||||
|
|
||||||
from flectra.addons.web.controllers import main as report
|
from flectra.addons.web.controllers import main as report
|
||||||
|
|
||||||
@ -41,7 +42,7 @@ class ReportController(report.ReportController):
|
|||||||
return super().report_routes(reportname, docids, converter, **data)
|
return super().report_routes(reportname, docids, converter, **data)
|
||||||
|
|
||||||
@route()
|
@route()
|
||||||
def report_download(self, data, token):
|
def report_download(self, data, token, context=None):
|
||||||
requestcontent = json.loads(data)
|
requestcontent = json.loads(data)
|
||||||
url, report_type = requestcontent[0], requestcontent[1]
|
url, report_type = requestcontent[0], requestcontent[1]
|
||||||
if report_type == "qweb-xml":
|
if report_type == "qweb-xml":
|
||||||
@ -55,14 +56,18 @@ class ReportController(report.ReportController):
|
|||||||
if docids:
|
if docids:
|
||||||
# Generic report:
|
# Generic report:
|
||||||
response = self.report_routes(
|
response = self.report_routes(
|
||||||
reportname, docids=docids, converter="xml"
|
reportname, docids=docids, converter="xml", context=context
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
# Particular report:
|
# Particular report:
|
||||||
# decoding the args represented in JSON
|
# decoding the args represented in JSON
|
||||||
data = url_decode(url.split("?")[1]).items()
|
data = dict(url_decode(url.split("?")[1]).items())
|
||||||
|
if "context" in data:
|
||||||
|
context = json.loads(context or "{}")
|
||||||
|
data_context = json.loads(data.pop("context"))
|
||||||
|
context = json.dumps({**context, **data_context})
|
||||||
response = self.report_routes(
|
response = self.report_routes(
|
||||||
reportname, converter="xml", **dict(data)
|
reportname, converter="xml", context=context, **data
|
||||||
)
|
)
|
||||||
|
|
||||||
report_obj = request.env["ir.actions.report"]
|
report_obj = request.env["ir.actions.report"]
|
||||||
@ -74,7 +79,7 @@ class ReportController(report.ReportController):
|
|||||||
records = request.env[report.model].browse(ids)
|
records = request.env[report.model].browse(ids)
|
||||||
if report.print_report_name and not len(records) > 1:
|
if report.print_report_name and not len(records) > 1:
|
||||||
report_name = safe_eval(
|
report_name = safe_eval(
|
||||||
report.print_report_name, {"object": records}
|
report.print_report_name, {"object": records, "time": time}
|
||||||
)
|
)
|
||||||
filename = "{}.xml".format(report_name)
|
filename = "{}.xml".format(report_name)
|
||||||
response.headers.add(
|
response.headers.add(
|
||||||
@ -87,4 +92,4 @@ class ReportController(report.ReportController):
|
|||||||
error = {"code": 200, "message": "Flectra Server Error", "data": se}
|
error = {"code": 200, "message": "Flectra Server Error", "data": se}
|
||||||
return request.make_response(html_escape(json.dumps(error)))
|
return request.make_response(html_escape(json.dumps(error)))
|
||||||
else:
|
else:
|
||||||
return super().report_download(data, token)
|
return super().report_download(data, token, context)
|
||||||
|
Loading…
Reference in New Issue
Block a user