From fa7d3d3f624810982f6e0ed381968b33b0b8a02d Mon Sep 17 00:00:00 2001
From: FernandoRomera
Date: Wed, 20 Dec 2023 08:04:43 +0100
Subject: [PATCH] [IMP] report_xlsx_helper: pre-commit auto fixes
---
report_xlsx_helper/README.rst | 74 ++++++++++---------
report_xlsx_helper/controllers/main.py | 1 -
report_xlsx_helper/pyproject.toml | 3 +
report_xlsx_helper/readme/CONTRIBUTORS.md | 8 ++
report_xlsx_helper/readme/CONTRIBUTORS.rst | 5 --
.../{DESCRIPTION.rst => DESCRIPTION.md} | 3 +-
.../readme/{INSTALL.rst => INSTALL.md} | 0
report_xlsx_helper/readme/USAGE.md | 33 +++++++++
report_xlsx_helper/readme/USAGE.rst | 32 --------
.../report/report_xlsx_abstract.py | 6 +-
.../report/test_partner_report_xlsx.py | 2 -
.../static/description/index.html | 40 +++++-----
12 files changed, 108 insertions(+), 99 deletions(-)
create mode 100644 report_xlsx_helper/pyproject.toml
create mode 100644 report_xlsx_helper/readme/CONTRIBUTORS.md
delete mode 100644 report_xlsx_helper/readme/CONTRIBUTORS.rst
rename report_xlsx_helper/readme/{DESCRIPTION.rst => DESCRIPTION.md} (65%)
rename report_xlsx_helper/readme/{INSTALL.rst => INSTALL.md} (100%)
create mode 100644 report_xlsx_helper/readme/USAGE.md
delete mode 100644 report_xlsx_helper/readme/USAGE.rst
diff --git a/report_xlsx_helper/README.rst b/report_xlsx_helper/README.rst
index aff9e8c91..d045ba610 100644
--- a/report_xlsx_helper/README.rst
+++ b/report_xlsx_helper/README.rst
@@ -17,18 +17,19 @@ Report xlsx helpers
: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/17.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-17-0/reporting-engine-17-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=17.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 +44,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.
+ 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 +84,7 @@ Bug Tracker
Bugs are tracked on `GitHub 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 `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -90,21 +92,25 @@ Credits
=======
Authors
-~~~~~~~
+-------
* Noviat
Contributors
-~~~~~~~~~~~~
+------------
-* Luc De Meyer
-* Rattapong Chokmasermkul
-* Saran Lim.
-* `Sinerkia Innovación y Desarrollo S.L. `_:
- * Luis Pomar
+- Luc De Meyer
+
+- Rattapong Chokmasermkul
+
+- Saran Lim.
+
+- `Sinerkia Innovación y Desarrollo S.L. `__:
+
+ - Luis Pomar
Maintainers
-~~~~~~~~~~~
+-----------
This module is maintained by the OCA.
@@ -116,6 +122,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 `_ project on GitHub.
+This module is part of the `OCA/reporting-engine `_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/report_xlsx_helper/controllers/main.py b/report_xlsx_helper/controllers/main.py
index d9536fb7d..09fa9a70f 100644
--- a/report_xlsx_helper/controllers/main.py
+++ b/report_xlsx_helper/controllers/main.py
@@ -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(",")]
diff --git a/report_xlsx_helper/pyproject.toml b/report_xlsx_helper/pyproject.toml
new file mode 100644
index 000000000..4231d0ccc
--- /dev/null
+++ b/report_xlsx_helper/pyproject.toml
@@ -0,0 +1,3 @@
+[build-system]
+requires = ["whool"]
+build-backend = "whool.buildapi"
diff --git a/report_xlsx_helper/readme/CONTRIBUTORS.md b/report_xlsx_helper/readme/CONTRIBUTORS.md
new file mode 100644
index 000000000..77f818752
--- /dev/null
+++ b/report_xlsx_helper/readme/CONTRIBUTORS.md
@@ -0,0 +1,8 @@
+- Luc De Meyer \<\>
+
+- Rattapong Chokmasermkul \<\>
+
+- Saran Lim. \<\>
+
+- [Sinerkia Innovación y Desarrollo S.L.](https://www.sinerkia.com):
+ - Luis Pomar
diff --git a/report_xlsx_helper/readme/CONTRIBUTORS.rst b/report_xlsx_helper/readme/CONTRIBUTORS.rst
deleted file mode 100644
index ee05b97de..000000000
--- a/report_xlsx_helper/readme/CONTRIBUTORS.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-* Luc De Meyer
-* Rattapong Chokmasermkul
-* Saran Lim.
-* `Sinerkia Innovación y Desarrollo S.L. `_:
- * Luis Pomar
diff --git a/report_xlsx_helper/readme/DESCRIPTION.rst b/report_xlsx_helper/readme/DESCRIPTION.md
similarity index 65%
rename from report_xlsx_helper/readme/DESCRIPTION.rst
rename to report_xlsx_helper/readme/DESCRIPTION.md
index 4f2b52c1b..b1fbb4a9a 100644
--- a/report_xlsx_helper/readme/DESCRIPTION.rst
+++ b/report_xlsx_helper/readme/DESCRIPTION.md
@@ -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.
diff --git a/report_xlsx_helper/readme/INSTALL.rst b/report_xlsx_helper/readme/INSTALL.md
similarity index 100%
rename from report_xlsx_helper/readme/INSTALL.rst
rename to report_xlsx_helper/readme/INSTALL.md
diff --git a/report_xlsx_helper/readme/USAGE.md b/report_xlsx_helper/readme/USAGE.md
new file mode 100644
index 000000000..ecd6fbbd1
--- /dev/null
+++ b/report_xlsx_helper/readme/USAGE.md
@@ -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 as example.
+
+- Excel with multiple sheets
+
+ Download the `account_asset_management_xls` module from
+ as example.
diff --git a/report_xlsx_helper/readme/USAGE.rst b/report_xlsx_helper/readme/USAGE.rst
deleted file mode 100644
index 6efc211b4..000000000
--- a/report_xlsx_helper/readme/USAGE.rst
+++ /dev/null
@@ -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.
diff --git a/report_xlsx_helper/report/report_xlsx_abstract.py b/report_xlsx_helper/report/report_xlsx_abstract.py
index ed8d7a332..1ea2ec556 100644
--- a/report_xlsx_helper/report/report_xlsx_abstract.py
+++ b/report_xlsx_helper/report/report_xlsx_abstract.py
@@ -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)
diff --git a/report_xlsx_helper/report/test_partner_report_xlsx.py b/report_xlsx_helper/report/test_partner_report_xlsx.py
index 481e5575f..00fe6fce0 100644
--- a/report_xlsx_helper/report/test_partner_report_xlsx.py
+++ b/report_xlsx_helper/report/test_partner_report_xlsx.py
@@ -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"},
@@ -46,7 +45,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"])
diff --git a/report_xlsx_helper/static/description/index.html b/report_xlsx_helper/static/description/index.html
index 3f3d5fe4b..594467b66 100644
--- a/report_xlsx_helper/static/description/index.html
+++ b/report_xlsx_helper/static/description/index.html
@@ -369,8 +369,9 @@ ul.auto-toc {
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:07e670ba3bc592076c782c24a73763641c491d37b4e44f75b894ea10315a47bb
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-

-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
@@ -391,33 +392,34 @@ ul.auto-toc {
-
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
-
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
string, number, boolean, datetime.
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 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
-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
-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.
@@ -426,7 +428,7 @@ from http://apps.odoo.
Bugs are tracked on GitHub 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.
+feedback.
Do not contact contributors directly about support or help with technical issues.
@@ -460,7 +458,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
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 project on GitHub.
+This module is part of the OCA/reporting-engine project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.