中国本土应用
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.

33 lines
1011B

  1. An example of XLSX report for partners on a module called `module_name`:
  2. A python class ::
  3. from odoo import models
  4. class PartnerXlsx(models.AbstractModel):
  5. _name = 'report.module_name.report_name'
  6. _inherit = 'report.report_xlsx.abstract'
  7. def generate_xlsx_report(self, workbook, data, partners):
  8. for obj in partners:
  9. report_name = obj.name
  10. # One sheet by partner
  11. sheet = workbook.add_worksheet(report_name[:31])
  12. bold = workbook.add_format({'bold': True})
  13. sheet.write(0, 0, obj.name, bold)
  14. To manipulate the ``workbook`` and ``sheet`` objects, refer to the
  15. `documentation <http://xlsxwriter.readthedocs.org/>`_ of ``xlsxwriter``.
  16. A report XML record ::
  17. <report
  18. id="partner_xlsx"
  19. model="res.partner"
  20. string="Print to XLSX"
  21. report_type="xlsx"
  22. name="module_name.report_name"
  23. file="res_partner"
  24. attachment_use="False"
  25. />
上海开阖软件有限公司 沪ICP备12045867号-1