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.

116 lines
2.9 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 fill PDF
  6. ====================
  7. This module provides a basic report class that fills pdfs.
  8. Installation
  9. ============
  10. Make sure you have ``fdfgen`` Python module installed::
  11. $ pip install fdfgen
  12. For testing it is also necessary ``pdftk`` app installed:
  13. Ubuntu ::
  14. apt-get install pdftk
  15. OSX ::
  16. * Install pdftk (https://www.pdflabs.com/tools/pdftk-server/).
  17. Windows ::
  18. * Install pdftk (https://www.pdflabs.com/tools/pdftk-server/).
  19. Usage
  20. =====
  21. An example of Fill PDF report for partners on a module called `module_name`:
  22. A python class ::
  23. from odoo import models
  24. class PartnerFillPDF(models.AbstractModel):
  25. _name = 'report.module_name.report_name'
  26. _inherit = 'report.report_fillpdf.abstract'
  27. @api.model
  28. def get_original_document_path(self, data, objs):
  29. return get_resource_path(
  30. 'report_fillpdf', 'static/src/pdf', 'partner_pdf.pdf')
  31. @api.model
  32. def get_document_values(self, data, objs):
  33. objs.ensure_one()
  34. return {'name': objs.name}
  35. A computed form can be executed modifying the computing function ::
  36. from odoo import models
  37. class PartnerFillPDF(models.AbstractModel):
  38. _name = 'report.module_name.report_name'
  39. _inherit = 'report.report_fillpdf.abstract'
  40. @api.model
  41. def get_form(self, data, objs):
  42. return self.env['ir.attachment'].search([], limit=1)
  43. @api.model
  44. def get_document_values(self, data, objs):
  45. objs.ensure_one()
  46. return {'name': objs.name}
  47. A report XML record ::
  48. <report
  49. id="partner_fillpdf"
  50. model="res.partner"
  51. string="Fill PDF"
  52. report_type="fillpdf"
  53. name="report_fillpdf.partner_fillpdf"
  54. file="res_partner"
  55. attachment_use="False"
  56. />
  57. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
  58. :alt: Try me on Runbot
  59. :target: https://runbot.odoo-community.org/runbot/143/11.0
  60. Bug Tracker
  61. ===========
  62. Bugs are tracked on `GitHub Issues
  63. <https://github.com/OCA/reporting-engine/issues>`_. In case of trouble, please
  64. check there if your issue has already been reported. If you spotted it first,
  65. help us smashing it by providing a detailed and welcomed feedback.
  66. Credits
  67. =======
  68. Contributors
  69. ------------
  70. * Enric Tobella <etobella@creublanca.es>
  71. Maintainer
  72. ----------
  73. .. image:: https://odoo-community.org/logo.png
  74. :alt: Odoo Community Association
  75. :target: https://odoo-community.org
  76. This module is maintained by the OCA.
  77. 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.
  78. To contribute to this module, please visit https://odoo-community.org.