diff --git a/pandoc-3.1.9-windows-x86_64.msi b/pandoc-3.1.9-windows-x86_64.msi new file mode 100644 index 000000000..1848c36b5 Binary files /dev/null and b/pandoc-3.1.9-windows-x86_64.msi differ diff --git a/report_xlsx/README.rst b/report_xlsx/README.rst index 5193ef785..14a5e7217 100644 --- a/report_xlsx/README.rst +++ b/report_xlsx/README.rst @@ -17,13 +17,13 @@ Base report xlsx :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 + :target: https://github.com/OCA/reporting-engine/tree/17.0/report_xlsx :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 + :target: https://translation.odoo-community.org/projects/reporting-engine-17-0/reporting-engine-17-0-report_xlsx :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| @@ -38,49 +38,59 @@ This module provides a basic report class to generate xlsx report. Installation ============ -Make sure you have ``xlsxwriter`` Python module installed:: +Make sure you have ``xlsxwriter`` Python module installed: -$ pip3 install xlsxwriter +:: -For testing it is also necessary ``xlrd`` Python module installed:: + $ pip3 install xlsxwriter -$ pip3 install xlrd +For testing it is also necessary ``xlrd`` Python module installed: + +:: + + $ pip3 install xlrd Usage ===== -An example of XLSX report for partners on a module called `module_name`: +An example of XLSX report for partners on a module called +\`module_name\`: -A python class :: +A python class : - from odoo import models +:: - class PartnerXlsx(models.AbstractModel): - _name = 'report.module_name.report_name' - _inherit = 'report.report_xlsx.abstract' + from odoo import models - def generate_xlsx_report(self, workbook, data, partners): - for obj in partners: - report_name = obj.name - # One sheet by partner - sheet = workbook.add_worksheet(report_name[:31]) - bold = workbook.add_format({'bold': True}) - sheet.write(0, 0, obj.name, bold) + class PartnerXlsx(models.AbstractModel): + _name = 'report.module_name.report_name' + _inherit = 'report.report_xlsx.abstract' + + def generate_xlsx_report(self, workbook, data, partners): + for obj in partners: + report_name = obj.name + # One sheet by partner + sheet = workbook.add_worksheet(report_name[:31]) + bold = workbook.add_format({'bold': True}) + sheet.write(0, 0, obj.name, bold) To manipulate the ``workbook`` and ``sheet`` objects, refer to the -`documentation `_ of ``xlsxwriter``. +`documentation `__ of +``xlsxwriter``. -A report XML record :: +A report XML record : - +:: + + Bug Tracker =========== @@ -88,7 +98,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. @@ -96,27 +106,27 @@ Credits ======= Authors -~~~~~~~ +------- * ACSONE SA/NV * Creu Blanca Contributors -~~~~~~~~~~~~ +------------ -* Adrien Peiffer -* S??bastien Alix -* St??phane Bidoul -* Enric Tobella -* Graeme Gellatly -* Cristian Salamea -* Rod Schouteden -* Eugene Molotov -* Christopher Ormaza -* Houz??fa Abbasbhay +- Adrien Peiffer +- S??bastien Alix +- St??phane Bidoul +- Enric Tobella +- Graeme Gellatly +- Cristian Salamea +- Rod Schouteden +- Eugene Molotov +- Christopher Ormaza +- Houz??fa Abbasbhay Maintainers -~~~~~~~~~~~ +----------- This module is maintained by the OCA. @@ -128,6 +138,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/controllers/main.py b/report_xlsx/controllers/main.py index 2fce11df2..61aa5033b 100644 --- a/report_xlsx/controllers/main.py +++ b/report_xlsx/controllers/main.py @@ -11,6 +11,8 @@ from odoo.http import ( content_disposition, request, route, +) +from odoo.http import ( serialize_exception as _serialize_exception, ) from odoo.tools import html_escape @@ -69,8 +71,9 @@ class ReportController(ReportController): url_decode(url.split("?")[1]).items() ) # decoding the args represented in JSON if "context" in data: - context, data_context = json.loads(context or "{}"), json.loads( - data.pop("context") + context, data_context = ( + json.loads(context or "{}"), + json.loads(data.pop("context")), ) context = json.dumps({**context, **data_context}) response = self.report_routes( diff --git a/report_xlsx/pyproject.toml b/report_xlsx/pyproject.toml new file mode 100644 index 000000000..4231d0ccc --- /dev/null +++ b/report_xlsx/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/report_xlsx/readme/CONTRIBUTORS.md b/report_xlsx/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..c376af976 --- /dev/null +++ b/report_xlsx/readme/CONTRIBUTORS.md @@ -0,0 +1,10 @@ +- Adrien Peiffer \<\> +- S??bastien Alix \<\> +- St??phane Bidoul \<\> +- Enric Tobella \<\> +- Graeme Gellatly \<\> +- Cristian Salamea \<\> +- Rod Schouteden \<\> +- Eugene Molotov \<\> +- Christopher Ormaza \<\> +- Houz??fa Abbasbhay \<\> diff --git a/report_xlsx/readme/CONTRIBUTORS.rst b/report_xlsx/readme/CONTRIBUTORS.rst deleted file mode 100644 index f9e7f1c59..000000000 --- a/report_xlsx/readme/CONTRIBUTORS.rst +++ /dev/null @@ -1,10 +0,0 @@ -* Adrien Peiffer -* S??bastien Alix -* St??phane Bidoul -* Enric Tobella -* Graeme Gellatly -* Cristian Salamea -* Rod Schouteden -* Eugene Molotov -* Christopher Ormaza -* Houz??fa Abbasbhay diff --git a/report_xlsx/readme/DESCRIPTION.rst b/report_xlsx/readme/DESCRIPTION.md similarity index 98% rename from report_xlsx/readme/DESCRIPTION.rst rename to report_xlsx/readme/DESCRIPTION.md index 894b12463..8f549d390 100644 --- a/report_xlsx/readme/DESCRIPTION.rst +++ b/report_xlsx/readme/DESCRIPTION.md @@ -1 +1 @@ -This module provides a basic report class to generate xlsx report. +This module provides a basic report class to generate xlsx report. diff --git a/report_xlsx/readme/INSTALL.md b/report_xlsx/readme/INSTALL.md new file mode 100644 index 000000000..9c6cf6e9e --- /dev/null +++ b/report_xlsx/readme/INSTALL.md @@ -0,0 +1,7 @@ +Make sure you have `xlsxwriter` Python module installed: + + $ pip3 install xlsxwriter + +For testing it is also necessary `xlrd` Python module installed: + + $ pip3 install xlrd diff --git a/report_xlsx/readme/INSTALL.rst b/report_xlsx/readme/INSTALL.rst deleted file mode 100644 index f75fbf25e..000000000 --- a/report_xlsx/readme/INSTALL.rst +++ /dev/null @@ -1,7 +0,0 @@ -Make sure you have ``xlsxwriter`` Python module installed:: - -$ pip3 install xlsxwriter - -For testing it is also necessary ``xlrd`` Python module installed:: - -$ pip3 install xlrd diff --git a/report_xlsx/readme/USAGE.rst b/report_xlsx/readme/USAGE.md similarity index 73% rename from report_xlsx/readme/USAGE.rst rename to report_xlsx/readme/USAGE.md index 751038564..fab76e9e6 100644 --- a/report_xlsx/readme/USAGE.rst +++ b/report_xlsx/readme/USAGE.md @@ -1,32 +1,33 @@ -An example of XLSX report for partners on a module called `module_name`: - -A python class :: - - from odoo import models - - class PartnerXlsx(models.AbstractModel): - _name = 'report.module_name.report_name' - _inherit = 'report.report_xlsx.abstract' - - def generate_xlsx_report(self, workbook, data, partners): - for obj in partners: - report_name = obj.name - # One sheet by partner - sheet = workbook.add_worksheet(report_name[:31]) - bold = workbook.add_format({'bold': True}) - sheet.write(0, 0, obj.name, bold) - -To manipulate the ``workbook`` and ``sheet`` objects, refer to the -`documentation `_ of ``xlsxwriter``. - -A report XML record :: - - +An example of XLSX report for partners on a module called +\`module_name\`: + +A python class : + + from odoo import models + + class PartnerXlsx(models.AbstractModel): + _name = 'report.module_name.report_name' + _inherit = 'report.report_xlsx.abstract' + + def generate_xlsx_report(self, workbook, data, partners): + for obj in partners: + report_name = obj.name + # One sheet by partner + sheet = workbook.add_worksheet(report_name[:31]) + bold = workbook.add_format({'bold': True}) + sheet.write(0, 0, obj.name, bold) + +To manipulate the `workbook` and `sheet` objects, refer to the +[documentation](http://xlsxwriter.readthedocs.org/) of `xlsxwriter`. + +A report XML record : + + diff --git a/report_xlsx/report/report_abstract_xlsx.py b/report_xlsx/report/report_abstract_xlsx.py index 3e70aac48..1e361273f 100644 --- a/report_xlsx/report/report_abstract_xlsx.py +++ b/report_xlsx/report/report_abstract_xlsx.py @@ -45,7 +45,7 @@ try: re.search(pattern, sheetname) and int(sheetname[-2:]) or 0 ) # Only up to 100 duplicates - deduplicated_secuence = "~{:02d}".format(duplicated_secuence + 1) + deduplicated_secuence = f"~{duplicated_secuence + 1:02d}" if duplicated_secuence > 99: raise xlsxwriter.exceptions.DuplicateWorksheetName # noqa: B904 if duplicated_secuence: diff --git a/report_xlsx/static/description/index.html b/report_xlsx/static/description/index.html index 7949f5b7b..05cf84080 100644 --- a/report_xlsx/static/description/index.html +++ b/report_xlsx/static/description/index.html @@ -1,478 +1,480 @@ - - - - - - -Base report xlsx - - - -
-

Base report xlsx

- - -

Mature License: AGPL-3 OCA/reporting-engine Translate me on Weblate Try me on Runboat

-

This module provides a basic report class to generate xlsx report.

-

Table of contents

- -
-

Installation

-

Make sure you have xlsxwriter Python module installed:

-
-$ pip3 install xlsxwriter
-
-

For testing it is also necessary xlrd Python module installed:

-
-$ pip3 install xlrd
-
-
-
-

Usage

-

An example of XLSX report for partners on a module called module_name:

-

A python class

-
-from odoo import models
-
-class PartnerXlsx(models.AbstractModel):
-    _name = 'report.module_name.report_name'
-    _inherit = 'report.report_xlsx.abstract'
-
-    def generate_xlsx_report(self, workbook, data, partners):
-        for obj in partners:
-            report_name = obj.name
-            # One sheet by partner
-            sheet = workbook.add_worksheet(report_name[:31])
-            bold = workbook.add_format({'bold': True})
-            sheet.write(0, 0, obj.name, bold)
-
-

To manipulate the workbook and sheet objects, refer to the -documentation of xlsxwriter.

-

A report XML record

-
-<report
-    id="partner_xlsx"
-    model="res.partner"
-    string="Print to XLSX"
-    report_type="xlsx"
-    name="module_name.report_name"
-    file="res_partner"
-    attachment_use="False"
-/>
-
-
-
-

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.

-

Do not contact contributors directly about support or help with technical issues.

-
-
-

Credits

-
-

Authors

-
    -
  • ACSONE SA/NV
  • -
  • Creu Blanca
  • -
-
-
-

Contributors

- -
-
-

Maintainers

-

This module is maintained by the OCA.

-Odoo Community Association -

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.

-

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

-
-
-
- - + + + + + + +Base report xlsx + + + +
+

Base report xlsx

+ + +

Mature License: AGPL-3 OCA/reporting-engine Translate me on Weblate Try me on Runboat

+

This module provides a basic report class to generate xlsx report.

+

Table of contents

+ +
+

Installation

+

Make sure you have xlsxwriter Python module installed:

+
+$ pip3 install xlsxwriter
+
+

For testing it is also necessary xlrd Python module installed:

+
+$ pip3 install xlrd
+
+
+
+

Usage

+

An example of XLSX report for partners on a module called +`module_name`:

+

A python class :

+
+from odoo import models
+
+class PartnerXlsx(models.AbstractModel):
+    _name = 'report.module_name.report_name'
+    _inherit = 'report.report_xlsx.abstract'
+
+    def generate_xlsx_report(self, workbook, data, partners):
+        for obj in partners:
+            report_name = obj.name
+            # One sheet by partner
+            sheet = workbook.add_worksheet(report_name[:31])
+            bold = workbook.add_format({'bold': True})
+            sheet.write(0, 0, obj.name, bold)
+
+

To manipulate the workbook and sheet objects, refer to the +documentation of +xlsxwriter.

+

A report XML record :

+
+<report
+    id="partner_xlsx"
+    model="res.partner"
+    string="Print to XLSX"
+    report_type="xlsx"
+    name="module_name.report_name"
+    file="res_partner"
+    attachment_use="False"
+/>
+
+
+
+

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.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • ACSONE SA/NV
  • +
  • Creu Blanca
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/report_xlsx/tests/test_report.py b/report_xlsx/tests/test_report.py index 6bfb836b5..ef0457eae 100644 --- a/report_xlsx/tests/test_report.py +++ b/report_xlsx/tests/test_report.py @@ -42,7 +42,6 @@ class TestReport(common.TransactionCase): self.assertEqual(attachment.name, f"{self.docs.name}.xlsx") def test_id_retrieval(self): - # Typical call from WebUI with wizard objs = self.xlsx_report._get_objs_for_report( False, {"context": {"active_ids": self.docs.ids}} diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 000000000..0bed16b5e --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +# generated from manifests external_dependencies +xlrd +xlsxwriter