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.

80 lines
2.1 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 csv
  6. ===============
  7. This module provides a basic report class to generate csv report.
  8. Usage
  9. =====
  10. An example of CSV report for partners on a module called `module_name`:
  11. A python class ::
  12. from odoo import models
  13. class PartnerCsv(models.AbstractModel):
  14. _name = 'report.module_name.report_name'
  15. _inherit = 'report.report_csv.abstract'
  16. def generate_csv_report(self, writer, data, partners):
  17. for obj in partners:
  18. writer.writeheader()
  19. writer.writerow({
  20. 'name': obj.name
  21. })
  22. def csv_report_options(self):
  23. res = super().csv_report_options()
  24. res['fieldnames'].append('name')
  25. return res
  26. A report XML record ::
  27. <report
  28. id="partner_csv"
  29. model="res.partner"
  30. string="Print to CSV"
  31. report_type="csv"
  32. name="module_name.report_name"
  33. file="res_partner"
  34. attachment_use="False"
  35. />
  36. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
  37. :alt: Try me on Runbot
  38. :target: https://runbot.odoo-community.org/runbot/143/11.0
  39. Bug Tracker
  40. ===========
  41. Bugs are tracked on `GitHub Issues
  42. <https://github.com/OCA/reporting-engine/issues>`_. In case of trouble, please
  43. check there if your issue has already been reported. If you spotted it first,
  44. help us smashing it by providing a detailed and welcomed feedback.
  45. Credits
  46. =======
  47. Contributors
  48. ------------
  49. * Enric Tobella <etobella@creublanca.es>
  50. Maintainer
  51. ----------
  52. .. image:: https://odoo-community.org/logo.png
  53. :alt: Odoo Community Association
  54. :target: https://odoo-community.org
  55. This module is maintained by the OCA.
  56. 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.
  57. To contribute to this module, please visit https://odoo-community.org.