diff --git a/report_qweb_pdf_watermark/README.rst b/report_qweb_pdf_watermark/README.rst index 16c8a95d..2b60389e 100644 --- a/report_qweb_pdf_watermark/README.rst +++ b/report_qweb_pdf_watermark/README.rst @@ -1,16 +1,41 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html - :alt: License: AGPL-3 - ============= Pdf watermark ============= +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github + :target: https://github.com/OCA/reporting-engine/tree/12.0/report_qweb_pdf_watermark + :alt: OCA/reporting-engine +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/reporting-engine-12-0/reporting-engine-12-0-report_qweb_pdf_watermark + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/143/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + This module was written to add watermarks (backgrounds) to PDF reports. Because of the way wkhtmltopdf handles headers and footers in the current versions, it is quite impossible to have a background for the complete page using HTML and CSS. That is why this module inserts the image at the PDF level. +**Table of contents** + +.. contents:: + :local: + Installation ============ + As PyPDF is not supported in python3, you need to install PyPDF2:: $ pip install pypdf2 @@ -24,50 +49,58 @@ To use this module, you need to: #. select a PDF or image to use as watermark. Note that resolutions and size must match, otherwise you'll have funny results #. You can also fill in an expression that returns the data (base64 encoded) to be used as watermark -.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas - :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/143/8.0 +Known issues / Roadmap +====================== -Known Issues -============ This module depends on support for transparent backgrounds in Wkhtmltopdf, which has been flaky in the past. This module has been reported to work with Wkhtmltopdf 0.12.4. +Changelog +========= + +12.0.1.0.0 (2019-11-18) +~~~~~~~~~~~~~~~~~~~~~~~ + +* [MIG] Migration to V12. + Bug Tracker =========== -Bugs are tracked on `GitHub Issues -`_. In case of trouble, please -check there if your issue has already been reported. If you spotted it first, -help us smashing it by providing a detailed and welcomed feedback. +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. Credits ======= -Images ------- +Authors +~~~~~~~ -* Odoo Community Association: `Icon `_. +* Therp BV Contributors ------------- +~~~~~~~~~~~~ * Holger Brunn * Stefan Rijnhart * Rod Schouteden +* Robin Goots -Do not contact contributors directly about help with questions or problems concerning this addon, but use the `community mailing list `_ or the `appropriate specialized mailinglist `_ for help, and the bug tracker linked in `Bug Tracker`_ above for technical issues. +Maintainers +~~~~~~~~~~~ -Maintainer ----------- +This module is maintained by the OCA. .. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association :target: https://odoo-community.org -This module is maintained by the OCA. - 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. -To contribute to this module, please visit https://odoo-community.org. +This module is part of the `OCA/reporting-engine `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/report_qweb_pdf_watermark/__manifest__.py b/report_qweb_pdf_watermark/__manifest__.py index 74b5ad78..9ee777f0 100644 --- a/report_qweb_pdf_watermark/__manifest__.py +++ b/report_qweb_pdf_watermark/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { "name": "Pdf watermark", - "version": "11.0.1.0.0", + "version": "12.0.1.0.0", "author": "Therp BV, " "Odoo Community Association (OCA)", "license": "AGPL-3", diff --git a/report_qweb_pdf_watermark/readme/CONTRIBUTORS.rst b/report_qweb_pdf_watermark/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..e171dddc --- /dev/null +++ b/report_qweb_pdf_watermark/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* Holger Brunn +* Stefan Rijnhart +* Rod Schouteden +* Robin Goots diff --git a/report_qweb_pdf_watermark/readme/DESCRIPTION.rst b/report_qweb_pdf_watermark/readme/DESCRIPTION.rst new file mode 100644 index 00000000..31f5962e --- /dev/null +++ b/report_qweb_pdf_watermark/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +This module was written to add watermarks (backgrounds) to PDF reports. Because of the way wkhtmltopdf handles headers and footers in the current versions, it is quite impossible to have a background for the complete page using HTML and CSS. That is why this module inserts the image at the PDF level. diff --git a/report_qweb_pdf_watermark/readme/HISTORY.rst b/report_qweb_pdf_watermark/readme/HISTORY.rst new file mode 100644 index 00000000..9917f688 --- /dev/null +++ b/report_qweb_pdf_watermark/readme/HISTORY.rst @@ -0,0 +1,4 @@ +12.0.1.0.0 (2019-11-18) +~~~~~~~~~~~~~~~~~~~~~~~ + +* [MIG] Migration to V12. diff --git a/report_qweb_pdf_watermark/readme/INSTALL.rst b/report_qweb_pdf_watermark/readme/INSTALL.rst new file mode 100644 index 00000000..dc11dadc --- /dev/null +++ b/report_qweb_pdf_watermark/readme/INSTALL.rst @@ -0,0 +1,4 @@ + +As PyPDF is not supported in python3, you need to install PyPDF2:: + +$ pip install pypdf2 diff --git a/report_qweb_pdf_watermark/readme/ROADMAP.rst b/report_qweb_pdf_watermark/readme/ROADMAP.rst new file mode 100644 index 00000000..22c286a8 --- /dev/null +++ b/report_qweb_pdf_watermark/readme/ROADMAP.rst @@ -0,0 +1 @@ +This module depends on support for transparent backgrounds in Wkhtmltopdf, which has been flaky in the past. This module has been reported to work with Wkhtmltopdf 0.12.4. diff --git a/report_qweb_pdf_watermark/readme/USAGE.rst b/report_qweb_pdf_watermark/readme/USAGE.rst new file mode 100644 index 00000000..13dff937 --- /dev/null +++ b/report_qweb_pdf_watermark/readme/USAGE.rst @@ -0,0 +1,5 @@ +To use this module, you need to: + +#. go to your report +#. select a PDF or image to use as watermark. Note that resolutions and size must match, otherwise you'll have funny results +#. You can also fill in an expression that returns the data (base64 encoded) to be used as watermark diff --git a/report_qweb_pdf_watermark/static/description/index.html b/report_qweb_pdf_watermark/static/description/index.html new file mode 100644 index 00000000..46b8e75f --- /dev/null +++ b/report_qweb_pdf_watermark/static/description/index.html @@ -0,0 +1,458 @@ + + + + + + +Pdf watermark + + + +
+

Pdf watermark

+ + +

Beta License: AGPL-3 OCA/reporting-engine Translate me on Weblate Try me on Runbot

+

This module was written to add watermarks (backgrounds) to PDF reports. Because of the way wkhtmltopdf handles headers and footers in the current versions, it is quite impossible to have a background for the complete page using HTML and CSS. That is why this module inserts the image at the PDF level.

+

Table of contents

+ +
+

Installation

+

As PyPDF is not supported in python3, you need to install PyPDF2:

+
+$ pip install pypdf2
+
+
+
+

Usage

+

To use this module, you need to:

+
    +
  1. go to your report
  2. +
  3. select a PDF or image to use as watermark. Note that resolutions and size must match, otherwise you’ll have funny results
  4. +
  5. You can also fill in an expression that returns the data (base64 encoded) to be used as watermark
  6. +
+
+
+

Known issues / Roadmap

+

This module depends on support for transparent backgrounds in Wkhtmltopdf, which has been flaky in the past. This module has been reported to work with Wkhtmltopdf 0.12.4.

+
+
+

Changelog

+
+

12.0.1.0.0 (2019-11-18)

+
    +
  • [MIG] Migration to V12.
  • +
+
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Therp BV
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

This module is part of the OCA/reporting-engine project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/report_qweb_pdf_watermark/tests/test_report_qweb_pdf_watermark.py b/report_qweb_pdf_watermark/tests/test_report_qweb_pdf_watermark.py index 17bd7aa0..545b01cd 100644 --- a/report_qweb_pdf_watermark/tests/test_report_qweb_pdf_watermark.py +++ b/report_qweb_pdf_watermark/tests/test_report_qweb_pdf_watermark.py @@ -5,26 +5,28 @@ from odoo.tests.common import HttpCase class TestReportQwebPdfWatermark(HttpCase): - def test_report_qweb_pdf_watermark(self): Image.init() # with our image, we have three self._test_report_images(3) - self.env.ref('report_qweb_pdf_watermark.demo_report').write({ - 'pdf_watermark_expression': False, - }) + self.env.ref("report_qweb_pdf_watermark.demo_report").write( + {"pdf_watermark_expression": False} + ) # without, we have two self._test_report_images(2) - self.env.ref('report_qweb_pdf_watermark.demo_report').write({ - 'pdf_watermark': self.env.user.company_id.logo, - }) + self.env.ref("report_qweb_pdf_watermark.demo_report").write( + {"pdf_watermark": self.env.user.company_id.logo} + ) # and now we should have three again self._test_report_images(3) def _test_report_images(self, number): - report = self.env['ir.model.data'].xmlid_to_object( - 'report_qweb_pdf_watermark.demo_report') - pdf, _ = report.render_qweb_pdf(self.env['res.users'].search([]).ids) - self.assertEqual(pdf.count(b'/Subtype /Image'), number) + report = self.env["ir.model.data"].xmlid_to_object( + "report_qweb_pdf_watermark.demo_report" + ) + pdf, _ = report.with_context(force_report_rendering=True).render_qweb_pdf( + self.env["res.users"].search([]).ids + ) + self.assertEqual(pdf.count(b"/Subtype /Image"), number)