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.

97 lines
2.8 KiB

  1. .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
  2. :target: http://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. Usage
  13. =====
  14. An example of XLSX report for partners:
  15. A python class ::
  16. from odoo.addons.report_xlsx.report.report_xlsx import ReportXlsx
  17. class PartnerXlsx(ReportXlsx):
  18. def generate_xlsx_report(self, workbook, data, partners):
  19. for obj in partners:
  20. report_name = obj.name
  21. # One sheet by partner
  22. sheet = workbook.add_worksheet(report_name[:31])
  23. bold = workbook.add_format({'bold': True})
  24. sheet.write(0, 0, obj.name, bold)
  25. PartnerXlsx('report.res.partner.xlsx',
  26. 'res.partner')
  27. To manipulate the ``workbook`` and ``sheet`` objects, refer to the
  28. `documentation <http://xlsxwriter.readthedocs.org/>`_ of ``xlsxwriter``.
  29. A report XML record ::
  30. <report
  31. id="partner_xlsx"
  32. model="res.partner"
  33. string="Print to XLSX"
  34. report_type="xlsx"
  35. name="res.partner.xlsx"
  36. file="res.partner.xlsx"
  37. attachment_use="False"
  38. />
  39. **XLSX Header & Footer**
  40. You can configure them on the menu *Settings > Technical > Reports > XLSX Header/Footer* following the syntax from
  41. `xlsxwriter documentation <https://xlsxwriter.readthedocs.io/page_setup.html#set_header>`_.
  42. Example of Header / Footer syntax : ``&LPage &P of &N &CFilename: &F &RSheetname: &A``
  43. On a report XML with ``report_type == 'xlsx'`` you can specified the Header and Footer you configured.
  44. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
  45. :alt: Try me on Runbot
  46. :target: https://runbot.odoo-community.org/runbot/143/10.0
  47. Bug Tracker
  48. ===========
  49. Bugs are tracked on `GitHub Issues
  50. <https://github.com/OCA/reporting-engine/issues>`_. In case of trouble, please
  51. check there if your issue has already been reported. If you spotted it first,
  52. help us smashing it by providing a detailed and welcomed feedback.
  53. Credits
  54. =======
  55. Contributors
  56. ------------
  57. * Adrien Peiffer <adrien.peiffer@acsone.eu>
  58. * Arnaud Pineux <arnaud.pineux@acsone.eu>
  59. Maintainer
  60. ----------
  61. .. image:: https://odoo-community.org/logo.png
  62. :alt: Odoo Community Association
  63. :target: https://odoo-community.org
  64. This module is maintained by the OCA.
  65. 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.
  66. To contribute to this module, please visit https://odoo-community.org.