update all kept modules to OCA 19.0 versions

bi_sql_editor 19.0.1.0.1, report_csv 19.0.1.0.0,
report_qweb_element_page_visibility 19.0.1.0.0,
report_xlsx_helper 19.0.1.0.0, report_xml 19.0.1.0.0,
sql_request_abstract 19.0.1.0.0

🤖 assisted by claude
This commit is contained in:
Ernad Husremovic 2026-03-09 22:24:48 +01:00
parent 05df50b41d
commit c18e7fd4c7
258 changed files with 8677 additions and 6341 deletions

View file

@ -1,3 +1,7 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association
===================
Report xlsx helpers
===================
@ -7,28 +11,29 @@ Report xlsx helpers
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:07e670ba3bc592076c782c24a73763641c491d37b4e44f75b894ea10315a47bb
!! source digest: sha256:e5ea9a89476b9adec8dbccb5f6c4b8da7c7b83c1582bbdcf9001e1f282e04ec0
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Mature-brightgreen.png
:target: https://odoo-community.org/page/development-status
:alt: Mature
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github
:target: https://github.com/OCA/reporting-engine/tree/16.0/report_xlsx_helper
:target: https://github.com/OCA/reporting-engine/tree/19.0/report_xlsx_helper
:alt: OCA/reporting-engine
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/reporting-engine-16-0/reporting-engine-16-0-report_xlsx_helper
:target: https://translation.odoo-community.org/projects/reporting-engine-19-0/reporting-engine-19-0-report_xlsx_helper
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/reporting-engine&target_branch=16.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/reporting-engine&target_branch=19.0
:alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5|
This module provides a set of tools to facilitate the creation of excel reports with format xlsx.
This module provides a set of tools to facilitate the creation of excel
reports with format xlsx.
**Table of contents**
@ -43,38 +48,39 @@ This module requires report_xlsx version 13.0.1.0.0 or higher.
Usage
=====
In order to create an Excel report you can define a report of type 'xlsx' in a static or dynamic way:
In order to create an Excel report you can define a report of type
'xlsx' in a static or dynamic way:
* Static syntax: cf. ``account_move_line_report_xls`` for an example.
* Dynamic syntax: cf. ``report_xlsx_helper_demo`` for an example
- Static syntax: cf. ``account_move_line_report_xls`` for an example.
- Dynamic syntax: cf. ``report_xlsx_helper_demo`` for an example
The ``AbstractReportXlsx`` class contains a number of attributes and methods to
facilitate the creation excel reports in Odoo.
The ``AbstractReportXlsx`` class contains a number of attributes and
methods to facilitate the creation excel reports in Odoo.
* Cell types
- Cell types
string, number, boolean, datetime.
* Cell formats
- Cell formats
The predefined cell formats result in a consistent
look and feel of the Odoo Excel reports.
The predefined cell formats result in a consistent look and feel of
the Odoo Excel reports.
* Cell formulas
- Cell formulas
Cell formulas can be easily added with the help of the ``_rowcol_to_cell()`` method.
Cell formulas can be easily added with the help of the
``_rowcol_to_cell()`` method.
* Excel templates
- Excel templates
It is possible to define Excel templates which can be adapted
by 'inherited' modules.
Download the ``account_move_line_report_xls`` module
from http://apps.odoo.com as example.
It is possible to define Excel templates which can be adapted by
'inherited' modules. Download the ``account_move_line_report_xls``
module from http://apps.odoo.com as example.
* Excel with multiple sheets
- Excel with multiple sheets
Download the ``account_asset_management_xls`` module
from http://apps.odoo.com as example.
Download the ``account_asset_management_xls`` module from
http://apps.odoo.com as example.
Bug Tracker
===========
@ -82,7 +88,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/reporting-engine/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/reporting-engine/issues/new?body=module:%20report_xlsx_helper%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/reporting-engine/issues/new?body=module:%20report_xlsx_helper%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
@ -90,21 +96,29 @@ Credits
=======
Authors
~~~~~~~
-------
* Noviat
Contributors
~~~~~~~~~~~~
------------
* Luc De Meyer <luc.demeyer@noviat.com>
* Rattapong Chokmasermkul <rattapongc@ecosoft.co.th>
* Saran Lim. <saranl@ecosoft.co.th>
* `Sinerkia Innovación y Desarrollo S.L. <https://www.sinerkia.com>`_:
* Luis Pomar
- Luc De Meyer <luc.demeyer@noviat.com>
- Rattapong Chokmasermkul <rattapongc@ecosoft.co.th>
- Saran Lim. <saranl@ecosoft.co.th>
- `Sinerkia Innovación y Desarrollo S.L. <https://www.sinerkia.com>`__:
- Luis Pomar
- `Studio73 <https://www.studio73.es>`__:
- Sergio Martínez <sergio.martinez@studio73.es>
Maintainers
~~~~~~~~~~~
-----------
This module is maintained by the OCA.
@ -116,6 +130,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
This module is part of the `OCA/reporting-engine <https://github.com/OCA/reporting-engine/tree/16.0/report_xlsx_helper>`_ project on GitHub.
This module is part of the `OCA/reporting-engine <https://github.com/OCA/reporting-engine/tree/19.0/report_xlsx_helper>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View file

@ -6,7 +6,7 @@
"author": "Noviat, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/reporting-engine",
"category": "Reporting",
"version": "16.0.1.0.0",
"version": "19.0.1.0.0",
"license": "AGPL-3",
"depends": ["report_xlsx"],
"development_status": "Mature",

View file

@ -21,7 +21,6 @@ class ReportController(ReportController):
def report_routes(self, reportname, docids=None, converter=None, **data):
report = request.env["ir.actions.report"]._get_report_from_name(reportname)
if converter == "xlsx" and not report:
context = dict(request.env.context)
if docids:
docids = [int(i) for i in docids.split(",")]
@ -42,8 +41,7 @@ class ReportController(ReportController):
xlsxhttpheaders = [
(
"Content-Type",
"application/vnd.openxmlformats-"
"officedocument.spreadsheetml.sheet",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
),
("Content-Length", len(xlsx)),
("Content-Disposition", content_disposition(report_file + ".xlsx")),

View file

@ -4,14 +4,15 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
#. module: report_xlsx_helper
#. odoo-python
@ -27,19 +28,19 @@ msgstr ""
#: code:addons/report_xlsx_helper/models/ir_actions_report.py:0
#, python-format
msgid "%s model was not found"
msgstr "%s model nije pronađen"
msgstr ""
#. module: report_xlsx_helper
#. odoo-python
#: code:addons/report_xlsx_helper/report/report_xlsx_abstract.py:0
#, python-format
msgid ", cellvalue %s"
msgstr ", vrijednost ćelije %s"
msgstr ""
#. module: report_xlsx_helper
#: model:ir.model,name:report_xlsx_helper.model_report_report_xlsx_abstract
msgid "Abstract XLSX Report"
msgstr "Apstraktni XLSX izvještaj"
msgstr ""
#. module: report_xlsx_helper
#. odoo-python
@ -94,9 +95,9 @@ msgstr ""
#. module: report_xlsx_helper
#: model:ir.model,name:report_xlsx_helper.model_ir_actions_report
msgid "Report Action"
msgstr "Akcija izvještaja"
msgstr ""
#. module: report_xlsx_helper
#: model:ir.model,name:report_xlsx_helper.model_report_report_xlsx_helper_test_partner_xlsx
msgid "Test Partner XLSX Report"
msgstr "Testni XLSX izvještaj o partnerima"
msgstr ""

View file

@ -4,9 +4,9 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-02-12 11:37+0000\n"
"PO-Revision-Date: 2024-02-12 10:46+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\n"

View file

@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Project-Id-Version: Odoo Server 19.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
@ -16,7 +16,6 @@ msgstr ""
#. module: report_xlsx_helper
#. odoo-python
#: code:addons/report_xlsx_helper/report/report_xlsx_abstract.py:0
#, python-format
msgid ""
"%(__name__)s, _write_line : programming error detected while processing "
"col_specs_section %(col_specs_section)s, column %(col)s"
@ -25,14 +24,12 @@ msgstr ""
#. module: report_xlsx_helper
#. odoo-python
#: code:addons/report_xlsx_helper/models/ir_actions_report.py:0
#, python-format
msgid "%s model was not found"
msgstr ""
#. module: report_xlsx_helper
#. odoo-python
#: code:addons/report_xlsx_helper/report/report_xlsx_abstract.py:0
#, python-format
msgid ", cellvalue %s"
msgstr ""
@ -41,10 +38,23 @@ msgstr ""
msgid "Abstract XLSX Report"
msgstr ""
#. module: report_xlsx_helper
#: model:ir.model.fields,field_description:report_xlsx_helper.field_ir_actions_report__display_name
#: model:ir.model.fields,field_description:report_xlsx_helper.field_report_report_xlsx_abstract__display_name
#: model:ir.model.fields,field_description:report_xlsx_helper.field_report_report_xlsx_helper_test_partner_xlsx__display_name
msgid "Display Name"
msgstr ""
#. module: report_xlsx_helper
#: model:ir.model.fields,field_description:report_xlsx_helper.field_ir_actions_report__id
#: model:ir.model.fields,field_description:report_xlsx_helper.field_report_report_xlsx_abstract__id
#: model:ir.model.fields,field_description:report_xlsx_helper.field_report_report_xlsx_helper_test_partner_xlsx__id
msgid "ID"
msgstr ""
#. module: report_xlsx_helper
#. odoo-python
#: code:addons/report_xlsx_helper/report/report_xlsx_abstract.py:0
#, python-format
msgid ""
"Programming Error:\n"
"\n"
@ -54,7 +64,6 @@ msgstr ""
#. module: report_xlsx_helper
#. odoo-python
#: code:addons/report_xlsx_helper/report/report_xlsx_abstract.py:0
#, python-format
msgid ""
"Programming Error:\n"
"\n"
@ -64,7 +73,6 @@ msgstr ""
#. module: report_xlsx_helper
#. odoo-python
#: code:addons/report_xlsx_helper/report/report_xlsx_abstract.py:0
#, python-format
msgid ""
"Programming Error:\n"
"\n"
@ -74,7 +82,6 @@ msgstr ""
#. module: report_xlsx_helper
#. odoo-python
#: code:addons/report_xlsx_helper/report/report_xlsx_abstract.py:0
#, python-format
msgid ""
"Programming Error:\n"
"\n"
@ -84,7 +91,6 @@ msgstr ""
#. module: report_xlsx_helper
#. odoo-python
#: code:addons/report_xlsx_helper/report/report_xlsx_abstract.py:0
#, python-format
msgid ""
"Programming Error:\n"
"\n"

View file

@ -0,0 +1,115 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * report_xlsx_helper
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2025-09-08 13:42+0000\n"
"Last-Translator: Betül Öğmen <betulo@eska.biz>\n"
"Language-Team: none\n"
"Language: tr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.10.4\n"
#. module: report_xlsx_helper
#. odoo-python
#: code:addons/report_xlsx_helper/report/report_xlsx_abstract.py:0
msgid ""
"%(__name__)s, _write_line : programming error detected while processing "
"col_specs_section %(col_specs_section)s, column %(col)s"
msgstr ""
"%(__name__)s, _write_line : işlenirken programlama hatası tespit edildi "
"col_specs_section %(col_specs_section)s, column %(col)s"
#. module: report_xlsx_helper
#. odoo-python
#: code:addons/report_xlsx_helper/models/ir_actions_report.py:0
msgid "%s model was not found"
msgstr "%s modeli bulunamadı"
#. module: report_xlsx_helper
#. odoo-python
#: code:addons/report_xlsx_helper/report/report_xlsx_abstract.py:0
msgid ", cellvalue %s"
msgstr ", hücre değeri %s"
#. module: report_xlsx_helper
#: model:ir.model,name:report_xlsx_helper.model_report_report_xlsx_abstract
msgid "Abstract XLSX Report"
msgstr "Temel XLSX Çıktısı"
#. module: report_xlsx_helper
#. odoo-python
#: code:addons/report_xlsx_helper/report/report_xlsx_abstract.py:0
msgid ""
"Programming Error:\n"
"\n"
"Excel Sheet name '%(name)s' contains unsupported special characters: '%(special_chars)s'."
msgstr ""
"Programlama Hatası:\n"
"\n"
"Excel Sayfası adı '%(ad)s' desteklenmeyen özel karakterler içeriyor: "
"'%(special_chars)s'."
#. module: report_xlsx_helper
#. odoo-python
#: code:addons/report_xlsx_helper/report/report_xlsx_abstract.py:0
msgid ""
"Programming Error:\n"
"\n"
"Excel Sheet name '%(name)s' should not exceed %(max_chars)s characters."
msgstr ""
"Programlama Hatası:\n"
"\n"
"Excel Sayfası adı '%(name)s' %(max_chars)s karakterlerini aşmamalıdır."
#. module: report_xlsx_helper
#. odoo-python
#: code:addons/report_xlsx_helper/report/report_xlsx_abstract.py:0
msgid ""
"Programming Error:\n"
"\n"
"The '%s' column is not defined in the worksheet column specifications."
msgstr ""
"Programlama Hatası:\n"
"\n"
"'%s' sütunu çalışma sayfası sütun belirtimlerinde tanımlanmamış."
#. module: report_xlsx_helper
#. odoo-python
#: code:addons/report_xlsx_helper/report/report_xlsx_abstract.py:0
msgid ""
"Programming Error:\n"
"\n"
"The '%s' column is not defined the worksheet column specifications."
msgstr ""
"Programlama Hatası:\n"
"\n"
"'%s' sütunu çalışma sayfası sütun belirtimlerinde tanımlanmamış."
#. module: report_xlsx_helper
#. odoo-python
#: code:addons/report_xlsx_helper/report/report_xlsx_abstract.py:0
msgid ""
"Programming Error:\n"
"\n"
"The 'title' parameter is mandatory when calling the '_write_ws_title' method."
msgstr ""
"Programlama Hatası:\n"
"\n"
"_write_ws_title' yöntemi çağrılırken 'title' parametresi zorunludur."
#. module: report_xlsx_helper
#: model:ir.model,name:report_xlsx_helper.model_ir_actions_report
msgid "Report Action"
msgstr "Rapor İşlemi"
#. module: report_xlsx_helper
#: model:ir.model,name:report_xlsx_helper.model_report_report_xlsx_helper_test_partner_xlsx
msgid "Test Partner XLSX Report"
msgstr "Test İş Ortağı XLSX Raporu"

View file

@ -1,7 +1,7 @@
# Copyright 2009-2018 Noviat.
# License AGPL-3.0 or later (https://www.gnuorg/licenses/agpl.html).
from odoo import _, api, models
from odoo import api, models
from odoo.exceptions import UserError
@ -14,6 +14,6 @@ class IrActionsReport(models.Model):
report_model_name = "report.{}".format(self.env.context["report_name"])
report_model = self.env.get(report_model_name)
if report_model is None:
raise UserError(_("%s model was not found") % report_model_name)
raise UserError(self.env._("%s model was not found", report_model_name))
return report_model.create_xlsx_report(docids, data)
return super()._render_xlsx(report_ref, docids, data)

View file

@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"

View file

@ -0,0 +1,11 @@
- Luc De Meyer \<<luc.demeyer@noviat.com>\>
- Rattapong Chokmasermkul \<<rattapongc@ecosoft.co.th>\>
- Saran Lim. \<<saranl@ecosoft.co.th>\>
- [Sinerkia Innovación y Desarrollo S.L.](https://www.sinerkia.com):
- Luis Pomar
- [Studio73](https://www.studio73.es):
- Sergio Martínez \<<sergio.martinez@studio73.es>\>

View file

@ -1,5 +0,0 @@
* Luc De Meyer <luc.demeyer@noviat.com>
* Rattapong Chokmasermkul <rattapongc@ecosoft.co.th>
* Saran Lim. <saranl@ecosoft.co.th>
* `Sinerkia Innovación y Desarrollo S.L. <https://www.sinerkia.com>`_:
* Luis Pomar

View file

@ -1 +1,2 @@
This module provides a set of tools to facilitate the creation of excel reports with format xlsx.
This module provides a set of tools to facilitate the creation of excel
reports with format xlsx.

View file

@ -0,0 +1,33 @@
In order to create an Excel report you can define a report of type
'xlsx' in a static or dynamic way:
- Static syntax: cf. `account_move_line_report_xls` for an example.
- Dynamic syntax: cf. `report_xlsx_helper_demo` for an example
The `AbstractReportXlsx` class contains a number of attributes and
methods to facilitate the creation excel reports in Odoo.
- Cell types
string, number, boolean, datetime.
- Cell formats
The predefined cell formats result in a consistent look and feel of
the Odoo Excel reports.
- Cell formulas
Cell formulas can be easily added with the help of the
`_rowcol_to_cell()` method.
- Excel templates
It is possible to define Excel templates which can be adapted by
'inherited' modules. Download the `account_move_line_report_xls`
module from <http://apps.odoo.com> as example.
- Excel with multiple sheets
Download the `account_asset_management_xls` module from
<http://apps.odoo.com> as example.

View file

@ -1,32 +0,0 @@
In order to create an Excel report you can define a report of type 'xlsx' in a static or dynamic way:
* Static syntax: cf. ``account_move_line_report_xls`` for an example.
* Dynamic syntax: cf. ``report_xlsx_helper_demo`` for an example
The ``AbstractReportXlsx`` class contains a number of attributes and methods to
facilitate the creation excel reports in Odoo.
* Cell types
string, number, boolean, datetime.
* Cell formats
The predefined cell formats result in a consistent
look and feel of the Odoo Excel reports.
* Cell formulas
Cell formulas can be easily added with the help of the ``_rowcol_to_cell()`` method.
* Excel templates
It is possible to define Excel templates which can be adapted
by 'inherited' modules.
Download the ``account_move_line_report_xls`` module
from http://apps.odoo.com as example.
* Excel with multiple sheets
Download the ``account_asset_management_xls`` module
from http://apps.odoo.com as example.

View file

@ -7,7 +7,7 @@ from types import CodeType
from xlsxwriter.utility import xl_rowcol_to_cell
from odoo import _, fields, models
from odoo import fields, models
from odoo.exceptions import UserError
from .report_xlsx_format import FORMATS, XLS_HEADERS
@ -36,22 +36,22 @@ class ReportXlsxAbstract(models.AbstractModel):
else:
if len(name) > max_chars:
raise UserError(
_(
self.env._(
"Programming Error:\n\n"
"Excel Sheet name '%(name)s' should not exceed %(max_chars)s "
"characters."
"characters.",
{"name": name, "max_chars": max_chars},
)
% {"name": name, "max_chars": max_chars}
)
special_chars = pattern.findall(name)
if special_chars:
raise UserError(
_(
self.env._(
"Programming Error:\n\n"
"Excel Sheet name '%(name)s' contains unsupported special "
"characters: '%(special_chars)s'."
"characters: '%(special_chars)s'.",
{"name": name, "special_chars": special_chars},
)
% {"name": name, "special_chars": special_chars}
)
return name
@ -108,11 +108,11 @@ class ReportXlsxAbstract(models.AbstractModel):
bg_yellow = "#FFFFCC"
bg_blue = "#CCFFFF"
num_format = "#,##0.00"
num_format_conditional = "{0};[Red]-{0};{0}".format(num_format)
num_format_conditional = f"{num_format};[Red]-{num_format};{num_format}"
pct_format = "#,##0.00%"
pct_format_conditional = "{0};[Red]-{0};{0}".format(pct_format)
pct_format_conditional = f"{pct_format};[Red]-{pct_format};{pct_format}"
int_format = "#,##0"
int_format_conditional = "{0};[Red]-{0};{0}".format(int_format)
int_format_conditional = f"{int_format};[Red]-{int_format};{int_format}"
date_format = "YYYY-MM-DD"
theader_grey = dict(theader, bg_color=bg_grey)
theader_yellow = dict(theader, bg_color=bg_yellow)
@ -348,10 +348,10 @@ class ReportXlsxAbstract(models.AbstractModel):
FORMATS["format_theader_yellow_amount_conditional_left"] = workbook.add_format(
dict(theader_yellow, num_format=num_format_conditional, align="left")
)
FORMATS[
"format_theader_yellow_amount_conditional_center"
] = workbook.add_format(
dict(theader_yellow, num_format=num_format_conditional, align="center")
FORMATS["format_theader_yellow_amount_conditional_center"] = (
workbook.add_format(
dict(theader_yellow, num_format=num_format_conditional, align="center")
)
)
FORMATS["format_theader_yellow_amount_conditional_right"] = workbook.add_format(
dict(theader_yellow, num_format=num_format_conditional, align="right")
@ -368,15 +368,15 @@ class ReportXlsxAbstract(models.AbstractModel):
FORMATS["format_theader_yellow_percent_conditional_left"] = workbook.add_format(
dict(theader_yellow, num_format=pct_format_conditional, align="left")
)
FORMATS[
"format_theader_yellow_percent_conditional_center"
] = workbook.add_format(
dict(theader_yellow, num_format=pct_format_conditional, align="center")
FORMATS["format_theader_yellow_percent_conditional_center"] = (
workbook.add_format(
dict(theader_yellow, num_format=pct_format_conditional, align="center")
)
)
FORMATS[
"format_theader_yellow_percent_conditional_right"
] = workbook.add_format(
dict(theader_yellow, num_format=pct_format_conditional, align="right")
FORMATS["format_theader_yellow_percent_conditional_right"] = (
workbook.add_format(
dict(theader_yellow, num_format=pct_format_conditional, align="right")
)
)
FORMATS["format_theader_yellow_integer_left"] = workbook.add_format(
dict(theader_yellow, num_format=int_format, align="left")
@ -390,15 +390,15 @@ class ReportXlsxAbstract(models.AbstractModel):
FORMATS["format_theader_yellow_integer_conditional_left"] = workbook.add_format(
dict(theader_yellow, num_format=int_format_conditional, align="left")
)
FORMATS[
"format_theader_yellow_integer_conditional_center"
] = workbook.add_format(
dict(theader_yellow, num_format=int_format_conditional, align="center")
FORMATS["format_theader_yellow_integer_conditional_center"] = (
workbook.add_format(
dict(theader_yellow, num_format=int_format_conditional, align="center")
)
)
FORMATS[
"format_theader_yellow_integer_conditional_right"
] = workbook.add_format(
dict(theader_yellow, num_format=int_format_conditional, align="right")
FORMATS["format_theader_yellow_integer_conditional_right"] = (
workbook.add_format(
dict(theader_yellow, num_format=int_format_conditional, align="right")
)
)
FORMATS["format_theader_blue_left"] = workbook.add_format(theader_blue)
@ -615,12 +615,12 @@ class ReportXlsxAbstract(models.AbstractModel):
for pos, col in enumerate(wl):
if col not in col_specs:
raise UserError(
_(
self.env._(
"Programming Error:\n\n"
"The '%s' column is not defined in the worksheet "
"column specifications."
"column specifications.",
col,
)
% col
)
ws.set_column(pos, pos, col_specs[col]["width"])
@ -633,7 +633,7 @@ class ReportXlsxAbstract(models.AbstractModel):
title = ws_params.get("title")
if not title:
raise UserError(
_(
self.env._(
"Programming Error:\n\n"
"The 'title' parameter is mandatory "
"when calling the '_write_ws_title' method."
@ -672,12 +672,12 @@ class ReportXlsxAbstract(models.AbstractModel):
for col in wl:
if col not in col_specs:
raise UserError(
_(
self.env._(
"Programming Error:\n\n"
"The '%s' column is not defined the worksheet "
"column specifications."
"column specifications.",
col,
)
% col
)
colspan = col_specs[col].get("colspan") or 1
cell_spec = col_specs[col].get(col_specs_section) or {}
@ -698,7 +698,7 @@ class ReportXlsxAbstract(models.AbstractModel):
cell_type = "boolean"
elif isinstance(cell_value, str):
cell_type = "string"
elif isinstance(cell_value, (int, float)):
elif isinstance(cell_value, int | float):
cell_type = "number"
elif isinstance(cell_value, datetime):
cell_type = "datetime"
@ -709,17 +709,19 @@ class ReportXlsxAbstract(models.AbstractModel):
if not cell_value:
cell_type = "blank"
else:
msg = _(
msg = self.env._(
"%(__name__)s, _write_line : programming error "
"detected while processing "
"col_specs_section %(col_specs_section)s, column %(col)s"
) % {
"__name__": __name__,
"col_specs_section": col_specs_section,
"col": col,
}
"col_specs_section %(col_specs_section)s, "
"column %(col)s",
{
"__name__": __name__,
"col_specs_section": col_specs_section,
"col": col,
},
)
if cell_value:
msg += _(", cellvalue %s") % cell_value
msg += self.env._(", cellvalue %s", cell_value)
raise UserError(msg)
colspan = cell_spec.get("colspan") or colspan
args_pos = [row_pos, pos]
@ -734,7 +736,7 @@ class ReportXlsxAbstract(models.AbstractModel):
args = args_pos + args_data
ws.merge_range(*args)
else:
ws_method = getattr(ws, "write_%s" % cell_type)
ws_method = getattr(ws, f"write_{cell_type}")
args = args_pos + args_data
ws_method(*args)
pos += colspan
@ -762,7 +764,7 @@ class ReportXlsxAbstract(models.AbstractModel):
render_space["datetime"] = datetime
# the use of eval is not a security thread as long as the
# col_specs template is defined in a python module
return eval(val, render_space) # pylint: disable=W0123,W8112
return eval(val, render_space) # pylint: disable=W0123
@staticmethod
def _rowcol_to_cell(row, col, row_abs=False, col_abs=False):

View file

@ -16,7 +16,6 @@ class TestPartnerXlsx(models.AbstractModel):
_description = "Test Partner XLSX Report"
def _get_ws_params(self, wb, data, partners):
partner_template = {
"name": {
"header": {"value": "Name"},
@ -28,9 +27,12 @@ class TestPartnerXlsx(models.AbstractModel):
"data": {"value": self._render("len(partner.child_ids)")},
"width": 10,
},
"date": {
"header": {"value": "Date"},
"data": {"value": self._render("partner.date")},
"create_date": {
"header": {"value": "Creation Date"},
"data": {
"value": self._render("partner.create_date"),
"format": FORMATS["format_date_right"],
},
"width": 13,
},
}
@ -46,7 +48,6 @@ class TestPartnerXlsx(models.AbstractModel):
return [ws_params]
def _partner_report(self, workbook, ws, ws_params, data, partners):
ws.set_portrait()
ws.fit_to_pages(1, 0)
ws.set_header(XLS_HEADERS["xls_headers"]["standard"])

View file

@ -1,18 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>Report xlsx helpers</title>
<title>README.rst</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
@ -275,7 +275,7 @@ pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
@ -301,7 +301,7 @@ span.option {
span.pre {
white-space: pre }
span.problematic {
span.problematic, pre.problematic {
color: red }
span.section-subtitle {
@ -360,17 +360,23 @@ ul.auto-toc {
</style>
</head>
<body>
<div class="document" id="report-xlsx-helpers">
<h1 class="title">Report xlsx helpers</h1>
<div class="document">
<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
</a>
<div class="section" id="report-xlsx-helpers">
<h1>Report xlsx helpers</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:07e670ba3bc592076c782c24a73763641c491d37b4e44f75b894ea10315a47bb
!! source digest: sha256:e5ea9a89476b9adec8dbccb5f6c4b8da7c7b83c1582bbdcf9001e1f282e04ec0
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Mature" src="https://img.shields.io/badge/maturity-Mature-brightgreen.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/reporting-engine/tree/16.0/report_xlsx_helper"><img alt="OCA/reporting-engine" src="https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/reporting-engine-16-0/reporting-engine-16-0-report_xlsx_helper"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/reporting-engine&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module provides a set of tools to facilitate the creation of excel reports with format xlsx.</p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Mature" src="https://img.shields.io/badge/maturity-Mature-brightgreen.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/reporting-engine/tree/19.0/report_xlsx_helper"><img alt="OCA/reporting-engine" src="https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/reporting-engine-19-0/reporting-engine-19-0-report_xlsx_helper"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/reporting-engine&amp;target_branch=19.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module provides a set of tools to facilitate the creation of excel
reports with format xlsx.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
@ -386,84 +392,88 @@ ul.auto-toc {
</ul>
</div>
<div class="section" id="installation">
<h1><a class="toc-backref" href="#toc-entry-1">Installation</a></h1>
<h2><a class="toc-backref" href="#toc-entry-1">Installation</a></h2>
<p>This module requires report_xlsx version 13.0.1.0.0 or higher.</p>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
<p>In order to create an Excel report you can define a report of type xlsx in a static or dynamic way:</p>
<h2><a class="toc-backref" href="#toc-entry-2">Usage</a></h2>
<p>In order to create an Excel report you can define a report of type
xlsx in a static or dynamic way:</p>
<ul class="simple">
<li>Static syntax: cf. <tt class="docutils literal">account_move_line_report_xls</tt> for an example.</li>
<li>Dynamic syntax: cf. <tt class="docutils literal">report_xlsx_helper_demo</tt> for an example</li>
</ul>
<p>The <tt class="docutils literal">AbstractReportXlsx</tt> class contains a number of attributes and methods to
facilitate the creation excel reports in Odoo.</p>
<p>The <tt class="docutils literal">AbstractReportXlsx</tt> class contains a number of attributes and
methods to facilitate the creation excel reports in Odoo.</p>
<ul>
<li><p class="first">Cell types</p>
<p>string, number, boolean, datetime.</p>
</li>
<li><p class="first">Cell formats</p>
<p>The predefined cell formats result in a consistent
look and feel of the Odoo Excel reports.</p>
<p>The predefined cell formats result in a consistent look and feel of
the Odoo Excel reports.</p>
</li>
<li><p class="first">Cell formulas</p>
<p>Cell formulas can be easily added with the help of the <tt class="docutils literal">_rowcol_to_cell()</tt> method.</p>
<p>Cell formulas can be easily added with the help of the
<tt class="docutils literal">_rowcol_to_cell()</tt> method.</p>
</li>
<li><p class="first">Excel templates</p>
<p>It is possible to define Excel templates which can be adapted
by inherited modules.
Download the <tt class="docutils literal">account_move_line_report_xls</tt> module
from <a class="reference external" href="http://apps.odoo.com">http://apps.odoo.com</a> as example.</p>
<p>It is possible to define Excel templates which can be adapted by
inherited modules. Download the <tt class="docutils literal">account_move_line_report_xls</tt>
module from <a class="reference external" href="http://apps.odoo.com">http://apps.odoo.com</a> as example.</p>
</li>
<li><p class="first">Excel with multiple sheets</p>
<p>Download the <tt class="docutils literal">account_asset_management_xls</tt> module
from <a class="reference external" href="http://apps.odoo.com">http://apps.odoo.com</a> as example.</p>
<p>Download the <tt class="docutils literal">account_asset_management_xls</tt> module from
<a class="reference external" href="http://apps.odoo.com">http://apps.odoo.com</a> as example.</p>
</li>
</ul>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
<h2><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h2>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/reporting-engine/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/reporting-engine/issues/new?body=module:%20report_xlsx_helper%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/reporting-engine/issues/new?body=module:%20report_xlsx_helper%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#toc-entry-4">Credits</a></h1>
<h2><a class="toc-backref" href="#toc-entry-4">Credits</a></h2>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#toc-entry-5">Authors</a></h2>
<h3><a class="toc-backref" href="#toc-entry-5">Authors</a></h3>
<ul class="simple">
<li>Noviat</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<h3><a class="toc-backref" href="#toc-entry-6">Contributors</a></h3>
<ul class="simple">
<li>Luc De Meyer &lt;<a class="reference external" href="mailto:luc.demeyer&#64;noviat.com">luc.demeyer&#64;noviat.com</a>&gt;</li>
<li>Rattapong Chokmasermkul &lt;<a class="reference external" href="mailto:rattapongc&#64;ecosoft.co.th">rattapongc&#64;ecosoft.co.th</a>&gt;</li>
<li>Saran Lim. &lt;<a class="reference external" href="mailto:saranl&#64;ecosoft.co.th">saranl&#64;ecosoft.co.th</a>&gt;</li>
<li><dl class="first docutils">
<dt><a class="reference external" href="https://www.sinerkia.com">Sinerkia Innovación y Desarrollo S.L.</a>:</dt>
<dd><ul class="first last">
<li><a class="reference external" href="https://www.sinerkia.com">Sinerkia Innovación y Desarrollo S.L.</a>:<ul>
<li>Luis Pomar</li>
</ul>
</dd>
</dl>
</li>
<li><a class="reference external" href="https://www.studio73.es">Studio73</a>:<ul>
<li>Sergio Martínez &lt;<a class="reference external" href="mailto:sergio.martinez&#64;studio73.es">sergio.martinez&#64;studio73.es</a>&gt;</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<h3><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h3>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/reporting-engine/tree/16.0/report_xlsx_helper">OCA/reporting-engine</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/reporting-engine/tree/19.0/report_xlsx_helper">OCA/reporting-engine</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -1,26 +1,28 @@
# Copyright 2009-2019 Noviat.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from datetime import date
from odoo.tests import tagged
from odoo.tests.common import TransactionCase
@tagged("post_install", "-at_install")
class TestReportXlsxHelper(TransactionCase):
def setUp(self):
super(TestReportXlsxHelper, self).setUp()
today = date.today()
p1 = self.env.ref("base.res_partner_1")
p2 = self.env.ref("base.res_partner_2")
p1.date = today
p2.date = today
self.partners = p1 + p2
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.partners = cls.env["res.partner"].create(
[
{"name": "Test Partner 1"},
{"name": "Test Partner 2"},
]
)
ctx = {
"report_name": "report_xlsx_helper.test_partner_xlsx",
"active_model": "res.partner",
"active_ids": self.partners.ids,
"active_ids": cls.partners.ids,
}
self.report = self.env["ir.actions.report"].with_context(**ctx)
cls.report = cls.env["ir.actions.report"].with_context(**ctx)
def test_report_xlsx_helper(self):
report_xls = self.report._render_xlsx(None, None, None)