OCA reporting engine fork for dev and update.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

127 lines
4.1 KiB

  1. ================
  2. Base report xlsx
  3. ================
  4. .. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  5. !! This file is generated by oca-gen-addon-readme !!
  6. !! changes will be overwritten. !!
  7. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  8. .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
  9. :target: https://odoo-community.org/page/development-status
  10. :alt: Beta
  11. .. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
  12. :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
  13. :alt: License: AGPL-3
  14. .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github
  15. :target: https://github.com/OCA/reporting-engine/tree/13.0/report_xlsx
  16. :alt: OCA/reporting-engine
  17. .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
  18. :target: https://translation.odoo-community.org/projects/reporting-engine-13-0/reporting-engine-13-0-report_xlsx
  19. :alt: Translate me on Weblate
  20. .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
  21. :target: https://runbot.odoo-community.org/runbot/143/13.0
  22. :alt: Try me on Runbot
  23. |badge1| |badge2| |badge3| |badge4| |badge5|
  24. This module provides a basic report class to generate xlsx report.
  25. **Table of contents**
  26. .. contents::
  27. :local:
  28. Installation
  29. ============
  30. Make sure you have ``xlsxwriter`` Python module installed::
  31. $ pip3 install xlsxwriter
  32. For testing it is also necessary ``xlrd`` Python module installed::
  33. $ pip3 install xlrd
  34. Usage
  35. =====
  36. An example of XLSX report for partners on a module called `module_name`:
  37. A python class ::
  38. from odoo import models
  39. class PartnerXlsx(models.AbstractModel):
  40. _name = 'report.module_name.report_name'
  41. _inherit = 'report.report_xlsx.abstract'
  42. def generate_xlsx_report(self, workbook, data, partners):
  43. for obj in partners:
  44. report_name = obj.name
  45. # One sheet by partner
  46. sheet = workbook.add_worksheet(report_name[:31])
  47. bold = workbook.add_format({'bold': True})
  48. sheet.write(0, 0, obj.name, bold)
  49. To manipulate the ``workbook`` and ``sheet`` objects, refer to the
  50. `documentation <http://xlsxwriter.readthedocs.org/>`_ of ``xlsxwriter``.
  51. A report XML record ::
  52. <report
  53. id="partner_xlsx"
  54. model="res.partner"
  55. string="Print to XLSX"
  56. report_type="xlsx"
  57. name="module_name.report_name"
  58. file="res_partner"
  59. attachment_use="False"
  60. />
  61. Bug Tracker
  62. ===========
  63. Bugs are tracked on `GitHub Issues <https://github.com/OCA/reporting-engine/issues>`_.
  64. In case of trouble, please check there if your issue has already been reported.
  65. If you spotted it first, help us smashing it by providing a detailed and welcomed
  66. `feedback <https://github.com/OCA/reporting-engine/issues/new?body=module:%20report_xlsx%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
  67. Do not contact contributors directly about support or help with technical issues.
  68. Credits
  69. =======
  70. Authors
  71. ~~~~~~~
  72. * ACSONE SA/NV
  73. * Creu Blanca
  74. Contributors
  75. ~~~~~~~~~~~~
  76. * Adrien Peiffer <adrien.peiffer@acsone.eu>
  77. * Sébastien Alix <sebastien.alix@osiell.com>
  78. * Stéphane Bidoul <stephane.bidoul@acsone.eu>
  79. * Enric Tobella <etobella@creublanca.es>
  80. * Graeme Gellatly <gdgellatly@gmail.com>
  81. * Cristian Salamea <cs@prisehub.com>
  82. * Rod Schouteden <rod.schouteden@dynapps.be>
  83. Maintainers
  84. ~~~~~~~~~~~
  85. This module is maintained by the OCA.
  86. .. image:: https://odoo-community.org/logo.png
  87. :alt: Odoo Community Association
  88. :target: https://odoo-community.org
  89. OCA, or the Odoo Community Association, is a nonprofit organization whose
  90. mission is to support the collaborative development of Odoo features and
  91. promote its widespread use.
  92. This module is part of the `OCA/reporting-engine <https://github.com/OCA/reporting-engine/tree/13.0/report_xlsx>`_ project on GitHub.
  93. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.