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.

93 lines
2.7 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. try:
  17. from openerp.addons.report_xlsx.report.report_xlsx import ReportXlsx
  18. except ImportError:
  19. class ReportXlsx(object):
  20. def __init__(self, *args, **kwargs):
  21. pass
  22. class PartnerXlsx(ReportXlsx):
  23. def generate_xlsx_report(self, workbook, data, partners):
  24. for obj in partners:
  25. report_name = obj.name
  26. # One sheet by partner
  27. sheet = workbook.add_worksheet(report_name[:31])
  28. bold = workbook.add_format({'bold': True})
  29. sheet.write(0, 0, obj.name, bold)
  30. PartnerXlsx('report.res.partner.xlsx', 'res.partner')
  31. To manipulate the ``workbook`` and ``sheet`` objects, refer to the
  32. `documentation <http://xlsxwriter.readthedocs.org/>`_ of ``xlsxwriter``.
  33. A report XML record ::
  34. <report
  35. id="partner_xlsx"
  36. model="res.partner"
  37. string="Print to XLSX"
  38. report_type="xlsx"
  39. name="res.partner.xlsx"
  40. file="res.partner.xlsx"
  41. attachment_use="False"
  42. />
  43. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
  44. :alt: Try me on Runbot
  45. :target: https://runbot.odoo-community.org/runbot/143/8.0
  46. Bug Tracker
  47. ===========
  48. Bugs are tracked on `GitHub Issues <https://github.com/OCA/reporting-engine/issues>`_.
  49. In case of trouble, please check there if your issue has already been reported.
  50. If you spotted it first, help us smashing it by providing a detailed and welcomed feedback
  51. `here <https://github.com/OCA/reporting-engine/issues/new?body=module:%20report_xlsx%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
  52. Credits
  53. =======
  54. * Icon taken from http://www.icons101.com/icon/id_67712/setid_2096/Boxed_Metal_by_Martin/xlsx.
  55. Contributors
  56. ------------
  57. * Adrien Peiffer <adrien.peiffer@acsone.eu>
  58. Maintainer
  59. ----------
  60. .. image:: https://odoo-community.org/logo.png
  61. :alt: Odoo Community Association
  62. :target: https://odoo-community.org
  63. This module is maintained by the OCA.
  64. 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.
  65. To contribute to this module, please visit https://odoo-community.org.