diff --git a/README.md b/README.md index fb80ebb..5c7b4fd 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,8 @@ addon | version | summary [bi_sql_editor](bi_sql_editor/) | 2.0.1.0.0| BI Views builder, based on Materialized or Normal SQL Views [report_wkhtmltopdf_param](report_wkhtmltopdf_param/) | 2.0.1.0.0| Add new parameters for a paper format to be used by wkhtmltopdf command as arguments. [report_qweb_pdf_watermark](report_qweb_pdf_watermark/) | 2.0.1.0.0| Add watermarks to your QWEB PDF reports -[report_xlsx_helper](report_xlsx_helper/) | 2.0.1.0.0| Report xlsx helpers -[report_xlsx](report_xlsx/) | 2.0.1.0.3| Base module to create xlsx report +[report_xlsx_helper](report_xlsx_helper/) | 2.0.1.0.1| Report xlsx helpers +[report_xlsx](report_xlsx/) | 2.0.1.0.4| Base module to create xlsx report [bi_view_editor](bi_view_editor/) | 2.0.1.0.0| Graphical BI views builder for Odoo [report_qweb_encrypt](report_qweb_encrypt/) | 2.0.1.0.0| Allow to encrypt qweb pdfs [report_qweb_parameter](report_qweb_parameter/) | 2.0.1.0.0| Add new parameters for qweb templates in order to reduce field length and check minimal length diff --git a/report_xlsx/README.rst b/report_xlsx/README.rst index f35be9e..fed2368 100644 --- a/report_xlsx/README.rst +++ b/report_xlsx/README.rst @@ -108,6 +108,7 @@ Contributors * Graeme Gellatly * Cristian Salamea * Rod Schouteden +* Eugene Molotov Maintainers ~~~~~~~~~~~ diff --git a/report_xlsx/__manifest__.py b/report_xlsx/__manifest__.py index c63b1e9..4fd0098 100644 --- a/report_xlsx/__manifest__.py +++ b/report_xlsx/__manifest__.py @@ -6,7 +6,7 @@ "author": "ACSONE SA/NV," "Creu Blanca," "Odoo Community Association (OCA)", "website": "https://gitlab.com/flectra-community/reporting-engine", "category": "Reporting", - "version": "2.0.1.0.3", + "version": "2.0.1.0.4", "development_status": "Production/Stable", "license": "AGPL-3", "external_dependencies": {"python": ["xlsxwriter", "xlrd"]}, diff --git a/report_xlsx/controllers/main.py b/report_xlsx/controllers/main.py index 1fcb900..32b6762 100644 --- a/report_xlsx/controllers/main.py +++ b/report_xlsx/controllers/main.py @@ -3,7 +3,8 @@ import json -from flectra.http import content_disposition, request, route +from flectra.http import content_disposition, request, route, serialize_exception +from flectra.tools import html_escape from flectra.tools.safe_eval import safe_eval from flectra.addons.web.controllers import main as report @@ -13,6 +14,13 @@ class ReportController(report.ReportController): @route() def report_routes(self, reportname, docids=None, converter=None, **data): if converter == "xlsx": + return self._report_routes_xlsx(reportname, docids, converter, **data) + return super(ReportController, self).report_routes( + reportname, docids, converter, **data + ) + + def _report_routes_xlsx(self, reportname, docids=None, converter=None, **data): + try: report = request.env["ir.actions.report"]._get_report_from_name(reportname) context = dict(request.env.context) if docids: @@ -42,6 +50,7 @@ class ReportController(report.ReportController): ("Content-Disposition", content_disposition(report_name + ".xlsx")), ] return request.make_response(xlsx, headers=xlsxhttpheaders) - return super(ReportController, self).report_routes( - reportname, docids, converter, **data - ) + except Exception as e: + se = serialize_exception(e) + error = {"code": 200, "message": "Flectra Server Error", "data": se} + return request.make_response(html_escape(json.dumps(error))) diff --git a/report_xlsx/static/description/index.html b/report_xlsx/static/description/index.html index 01cfa28..dd3fe56 100644 --- a/report_xlsx/static/description/index.html +++ b/report_xlsx/static/description/index.html @@ -455,6 +455,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
  • Graeme Gellatly <gdgellatly@gmail.com>
  • Cristian Salamea <cs@prisehub.com>
  • Rod Schouteden <rod.schouteden@dynapps.be>
  • +
  • Eugene Molotov <molotov@it-projects.info>
  • diff --git a/report_xlsx_helper/__manifest__.py b/report_xlsx_helper/__manifest__.py index 190d116..fdd7eb6 100644 --- a/report_xlsx_helper/__manifest__.py +++ b/report_xlsx_helper/__manifest__.py @@ -6,7 +6,7 @@ "author": "Noviat, Odoo Community Association (OCA)", "website": "https://gitlab.com/flectra-community/reporting-engine", "category": "Reporting", - "version": "2.0.1.0.0", + "version": "2.0.1.0.1", "license": "AGPL-3", "depends": ["report_xlsx"], "installable": True, diff --git a/report_xlsx_helper/report/report_xlsx_abstract.py b/report_xlsx_helper/report/report_xlsx_abstract.py index bddb72e..073fec9 100644 --- a/report_xlsx_helper/report/report_xlsx_abstract.py +++ b/report_xlsx_helper/report/report_xlsx_abstract.py @@ -723,6 +723,7 @@ class ReportXlsxAbstract(models.AbstractModel): if isinstance(cell_format, CodeType): cell_format = self._eval(cell_format, render_space) args_data.append(cell_format) + self._apply_formula_quirk(args_data, cell_type, cell_format) if colspan > 1: args_pos += [row_pos, pos + colspan - 1] args = args_pos + args_data @@ -735,6 +736,15 @@ class ReportXlsxAbstract(models.AbstractModel): return row_pos + 1 + @staticmethod + def _apply_formula_quirk(args_data, cell_type, cell_format): + """ Insert empty value to force LibreOffice to recompute the value """ + if cell_type == "formula": + if not cell_format: + # Insert positional argument for missing format + args_data.append(None) + args_data.append("") + @staticmethod def _render(code): return compile(code, "", "eval")