[IMP] report_xlsx_helper: pre-commit auto fixes

This commit is contained in:
FernandoRomera
2023-12-20 08:04:43 +01:00
committed by Alexis de Lattre
parent 18988cd03a
commit fa7d3d3f62
12 changed files with 108 additions and 99 deletions

View File

@@ -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 <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:%2017.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 +92,25 @@ 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
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 <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/17.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

@@ -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(",")]

View File

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

View File

@@ -0,0 +1,8 @@
- 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,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

@@ -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)

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"},
@@ -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"])

View File

@@ -369,8 +369,9 @@ ul.auto-toc {
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:07e670ba3bc592076c782c24a73763641c491d37b4e44f75b894ea10315a47bb
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/reporting-engine/tree/17.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-17-0/reporting-engine-17-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=17.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">
@@ -391,33 +392,34 @@ ul.auto-toc {
</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>
<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>
@@ -426,7 +428,7 @@ from <a class="reference external" href="http://apps.odoo.com">http://apps.odoo.
<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:%2017.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">
@@ -443,13 +445,9 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
<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>
</ul>
</div>
@@ -460,7 +458,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
<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/17.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>