[IMP] report_qweb_pdf_watermark: black, isort, prettier

This commit is contained in:
Sander Lienaerts
2024-01-12 15:15:01 +01:00
parent 8ab367ada9
commit 18eb03d9a2
14 changed files with 135 additions and 116 deletions

View File

@@ -17,18 +17,22 @@ Pdf watermark
: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/16.0/report_qweb_pdf_watermark
:target: https://github.com/OCA/reporting-engine/tree/17.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-16-0/reporting-engine-16-0-report_qweb_pdf_watermark
:target: https://translation.odoo-community.org/projects/reporting-engine-17-0/reporting-engine-17-0-report_qweb_pdf_watermark
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/reporting-engine&target_branch=16.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/reporting-engine&target_branch=17.0
:alt: Try me on Runboat
|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.
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**
@@ -38,71 +42,74 @@ This module was written to add watermarks (backgrounds) to PDF reports. Because
Installation
============
As PyPDF is not supported in python3, you need to install PyPDF2:
As PyPDF is not supported in python3, you need to install PyPDF2::
::
$ pip install pypdf2
$ pip install pypdf2
Usage
=====
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
1. go to your report
2. select a PDF or image to use as watermark. Note that resolutions and
size must match, otherwise you'll have funny results
3. You can also fill in an expression that returns the data (base64
encoded) to be used as watermark
To use the Company watermark, you need to:
#. go to settings --> company --> update info
#. upload an pdf watermark
#. go to settings --> technical --> reporting --> reports
#. Select the report where you want to use it.
#. On the 'Advanced Properties' tab of the notebook check 'use company watermark'
1. go to settings --> company --> update info
2. upload an pdf watermark
3. go to settings --> technical --> reporting --> reports
4. Select the report where you want to use it.
5. On the 'Advanced Properties' tab of the notebook check 'use company
watermark'
### Demo
And demo report is available (if you have demo data installed) on the users form view.
### Demo And demo report is available (if you have demo data installed)
on the users form view.
#. go to Configuration --> users
#. Select an users
#. Click the print button --> Watermark Demo report.
1. go to Configuration --> users
2. Select an users
3. Click the print button --> Watermark Demo report.
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.
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.
-----------------------
- [MIG] Migration to V12.
13.0.1.0.0 (2021-01-27)
~~~~~~~~~~~~~~~~~~~~~~~
* [MIG] Migration to V13.
-----------------------
- [MIG] Migration to V13.
14.0.1.0.0 (2021-01-29)
~~~~~~~~~~~~~~~~~~~~~~~
* [MIG] Migration to V14.
-----------------------
- [MIG] Migration to V14.
15.0.1.0.0 (2022-01-11)
~~~~~~~~~~~~~~~~~~~~~~~
-----------------------
* [MIG] Migration to V15.
* Define pdf watermark in company settings
- [MIG] Migration to V15.
- Define pdf watermark in company settings
16.0.1.0.0 (2023-03-13)
~~~~~~~~~~~~~~~~~~~~~~~
-----------------------
* [MIG] Migration to V16.
- [MIG] Migration to V16.
Bug Tracker
===========
@@ -110,7 +117,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/reporting-engine/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/reporting-engine/issues/new?body=module:%20report_qweb_pdf_watermark%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/reporting-engine/issues/new?body=module:%20report_qweb_pdf_watermark%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
@@ -118,23 +125,23 @@ Credits
=======
Authors
~~~~~~~
-------
* Therp BV
Contributors
~~~~~~~~~~~~
------------
* Holger Brunn <hbrunn@therp.nl>
* Stefan Rijnhart <stefan@opener.am>
* Rod Schouteden <rod.schouteden@dynapps.be>
* Robin Goots <robin.goots@dynapps.be>
* Foram Shah <foram.shah@initos.com>
* Emiel van Bokhoven <emiel@360erp.nl>
* Anjeel Haria
- Holger Brunn <hbrunn@therp.nl>
- Stefan Rijnhart <stefan@opener.am>
- Rod Schouteden <rod.schouteden@dynapps.be>
- Robin Goots <robin.goots@dynapps.be>
- Foram Shah <foram.shah@initos.com>
- Emiel van Bokhoven <emiel@360erp.nl>
- Anjeel Haria
Maintainers
~~~~~~~~~~~
-----------
This module is maintained by the OCA.
@@ -146,6 +153,6 @@ 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 <https://github.com/OCA/reporting-engine/tree/16.0/report_qweb_pdf_watermark>`_ project on GitHub.
This module is part of the `OCA/reporting-engine <https://github.com/OCA/reporting-engine/tree/17.0/report_qweb_pdf_watermark>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"

View File

@@ -0,0 +1,7 @@
- Holger Brunn \<<hbrunn@therp.nl>\>
- Stefan Rijnhart \<<stefan@opener.am>\>
- Rod Schouteden \<<rod.schouteden@dynapps.be>\>
- Robin Goots \<<robin.goots@dynapps.be>\>
- Foram Shah \<<foram.shah@initos.com>\>
- Emiel van Bokhoven \<<emiel@360erp.nl>\>
- Anjeel Haria

View File

@@ -1,7 +0,0 @@
* Holger Brunn <hbrunn@therp.nl>
* Stefan Rijnhart <stefan@opener.am>
* Rod Schouteden <rod.schouteden@dynapps.be>
* Robin Goots <robin.goots@dynapps.be>
* Foram Shah <foram.shah@initos.com>
* Emiel van Bokhoven <emiel@360erp.nl>
* Anjeel Haria

View File

@@ -0,0 +1,5 @@
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.

View File

@@ -1 +0,0 @@
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.

View File

@@ -0,0 +1,20 @@
## 12.0.1.0.0 (2019-11-18)
- \[MIG\] Migration to V12.
## 13.0.1.0.0 (2021-01-27)
- \[MIG\] Migration to V13.
## 14.0.1.0.0 (2021-01-29)
- \[MIG\] Migration to V14.
## 15.0.1.0.0 (2022-01-11)
- \[MIG\] Migration to V15.
- Define pdf watermark in company settings
## 16.0.1.0.0 (2023-03-13)
- \[MIG\] Migration to V16.

View File

@@ -1,28 +0,0 @@
12.0.1.0.0 (2019-11-18)
~~~~~~~~~~~~~~~~~~~~~~~
* [MIG] Migration to V12.
13.0.1.0.0 (2021-01-27)
~~~~~~~~~~~~~~~~~~~~~~~
* [MIG] Migration to V13.
14.0.1.0.0 (2021-01-29)
~~~~~~~~~~~~~~~~~~~~~~~
* [MIG] Migration to V14.
15.0.1.0.0 (2022-01-11)
~~~~~~~~~~~~~~~~~~~~~~~
* [MIG] Migration to V15.
* Define pdf watermark in company settings
16.0.1.0.0 (2023-03-13)
~~~~~~~~~~~~~~~~~~~~~~~
* [MIG] Migration to V16.

View File

@@ -1,4 +1,3 @@
As PyPDF is not supported in python3, you need to install PyPDF2:
As PyPDF is not supported in python3, you need to install PyPDF2::
$ pip install pypdf2
$ pip install pypdf2

View File

@@ -0,0 +1,3 @@
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.

View File

@@ -1 +0,0 @@
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.

View File

@@ -0,0 +1,23 @@
To use this module, you need to:
1. go to your report
2. select a PDF or image to use as watermark. Note that resolutions and
size must match, otherwise you'll have funny results
3. You can also fill in an expression that returns the data (base64
encoded) to be used as watermark
To use the Company watermark, you need to:
1. go to settings --\> company --\> update info
2. upload an pdf watermark
3. go to settings --\> technical --\> reporting --\> reports
4. Select the report where you want to use it.
5. On the 'Advanced Properties' tab of the notebook check 'use company
watermark'
\### Demo And demo report is available (if you have demo data installed)
on the users form view.
1. go to Configuration --\> users
2. Select an users
3. Click the print button --\> Watermark Demo report.

View File

@@ -1,20 +0,0 @@
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
To use the Company watermark, you need to:
#. go to settings --> company --> update info
#. upload an pdf watermark
#. go to settings --> technical --> reporting --> reports
#. Select the report where you want to use it.
#. On the 'Advanced Properties' tab of the notebook check 'use company watermark'
### Demo
And demo report is available (if you have demo data installed) on the users form view.
#. go to Configuration --> users
#. Select an users
#. Click the print button --> Watermark Demo report.

View File

@@ -369,8 +369,12 @@ ul.auto-toc {
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:2940fdc81ee124d4fef7eef00d6394463dddb5177a4996e6c5ffcb6a19b5734e
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/reporting-engine/tree/16.0/report_qweb_pdf_watermark"><img alt="OCA/reporting-engine" src="https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/reporting-engine-16-0/reporting-engine-16-0-report_qweb_pdf_watermark"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/reporting-engine&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>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.</p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/reporting-engine/tree/17.0/report_qweb_pdf_watermark"><img alt="OCA/reporting-engine" src="https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/reporting-engine-17-0/reporting-engine-17-0-report_qweb_pdf_watermark"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/reporting-engine&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>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.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
@@ -406,8 +410,10 @@ $ pip install pypdf2
<p>To use this module, you need to:</p>
<ol class="arabic simple">
<li>go to your report</li>
<li>select a PDF or image to use as watermark. Note that resolutions and size must match, otherwise youll have funny results</li>
<li>You can also fill in an expression that returns the data (base64 encoded) to be used as watermark</li>
<li>select a PDF or image to use as watermark. Note that resolutions and
size must match, otherwise youll have funny results</li>
<li>You can also fill in an expression that returns the data (base64
encoded) to be used as watermark</li>
</ol>
<p>To use the Company watermark, you need to:</p>
<ol class="arabic simple">
@@ -415,10 +421,11 @@ $ pip install pypdf2
<li>upload an pdf watermark</li>
<li>go to settings &gt; technical &gt; reporting &gt; reports</li>
<li>Select the report where you want to use it.</li>
<li>On the Advanced Properties tab of the notebook check use company watermark</li>
<li>On the Advanced Properties tab of the notebook check use company
watermark</li>
</ol>
<p>### Demo
And demo report is available (if you have demo data installed) on the users form view.</p>
<p>### Demo And demo report is available (if you have demo data installed)
on the users form view.</p>
<ol class="arabic simple">
<li>go to Configuration &gt; users</li>
<li>Select an users</li>
@@ -427,7 +434,9 @@ And demo report is available (if you have demo data installed) on the users form
</div>
<div class="section" id="known-issues-roadmap">
<h1><a class="toc-backref" href="#toc-entry-3">Known issues / Roadmap</a></h1>
<p>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.</p>
<p>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.</p>
</div>
<div class="section" id="changelog">
<h1><a class="toc-backref" href="#toc-entry-4">Changelog</a></h1>
@@ -468,7 +477,7 @@ And demo report is available (if you have demo data installed) on the users form
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/reporting-engine/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/reporting-engine/issues/new?body=module:%20report_qweb_pdf_watermark%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/reporting-engine/issues/new?body=module:%20report_qweb_pdf_watermark%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
@@ -498,7 +507,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/reporting-engine/tree/16.0/report_qweb_pdf_watermark">OCA/reporting-engine</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/reporting-engine/tree/17.0/report_qweb_pdf_watermark">OCA/reporting-engine</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>