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.

91 lines
2.5 KiB

  1. .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
  2. :target: https://www.gnu.org/licenses/agpl-3.0-standalone.html
  3. :alt: License: AGPL-3
  4. ================
  5. Base report xlsx
  6. ================
  7. This module provides a basic report class to generate xlsx report.
  8. Installation
  9. ============
  10. Make sure you have ``xlsxwriter`` Python module installed::
  11. $ pip install xlsxwriter
  12. For testing it is also necessary ``xlrd`` Python module installed::
  13. $ pip install xlrd
  14. Usage
  15. =====
  16. An example of XLSX report for partners on a module called `module_name`:
  17. A python class ::
  18. from odoo import models
  19. class PartnerXlsx(models.AbstractModel):
  20. _name = 'report.module_name.report_name'
  21. _inherit = 'report.report_xlsx.abstract'
  22. def generate_xlsx_report(self, workbook, data, partners):
  23. for obj in partners:
  24. report_name = obj.name
  25. # One sheet by partner
  26. sheet = workbook.add_worksheet(report_name[:31])
  27. bold = workbook.add_format({'bold': True})
  28. sheet.write(0, 0, obj.name, bold)
  29. To manipulate the ``workbook`` and ``sheet`` objects, refer to the
  30. `documentation <http://xlsxwriter.readthedocs.org/>`_ of ``xlsxwriter``.
  31. A report XML record ::
  32. <report
  33. id="partner_xlsx"
  34. model="res.partner"
  35. string="Print to XLSX"
  36. report_type="xlsx"
  37. name="module_name.report_name"
  38. file="res_partner"
  39. attachment_use="False"
  40. />
  41. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
  42. :alt: Try me on Runbot
  43. :target: https://runbot.odoo-community.org/runbot/143/12.0
  44. Bug Tracker
  45. ===========
  46. Bugs are tracked on `GitHub Issues
  47. <https://github.com/OCA/reporting-engine/issues>`_. In case of trouble, please
  48. check there if your issue has already been reported. If you spotted it first,
  49. help us smashing it by providing a detailed and welcomed feedback.
  50. Credits
  51. =======
  52. Contributors
  53. ------------
  54. * Adrien Peiffer <adrien.peiffer@acsone.eu>
  55. * Enric Tobella <etobella@creublanca.es>
  56. * Cristian Salamea <cs@prisehub.com>
  57. Maintainer
  58. ----------
  59. .. image:: https://odoo-community.org/logo.png
  60. :alt: Odoo Community Association
  61. :target: https://odoo-community.org
  62. This module is maintained by the OCA.
  63. 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.
  64. To contribute to this module, please visit https://odoo-community.org.