Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[18.0][MIG] report_qweb_pdf_watermark #959

Open
wants to merge 48 commits into
base: 18.0
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
07202c2
report_qweb_pdf_watermark (#86)
hbrunn Jan 9, 2017
7145fc6
OCA Transbot updated translations from Transifex
oca-transbot Jan 14, 2017
c94c853
[MIG] report_qweb_pdf_watermark
StefanRijnhart Apr 22, 2017
7f540d0
[ADD] Prioritize background transparency
StefanRijnhart Apr 24, 2017
fcaf22d
OCA Transbot updated translations from Transifex
oca-transbot Jun 3, 2017
7a7da6c
[FIX] Fix Watermark from PNG
etobella Jun 20, 2017
72a4bfc
OCA Transbot updated translations from Transifex
oca-transbot Jul 1, 2017
8322ee3
[IMP] use PyPDF2 if possible
hbrunn Jun 8, 2017
79e39c9
[UPD] build environment
hbrunn Jul 18, 2017
aa058d0
fix test_report_qweb_signer - tests were causing travis to stall
JordiBForgeFlow Sep 14, 2017
230e2c9
OCA Transbot updated translations from Transifex
oca-transbot Mar 3, 2018
640e7f9
[FIX] Don't break printing some upstream reports with invalid models
StefanRijnhart Feb 28, 2018
77e2b18
[UPD] Update report_qweb_pdf_watermark.pot
oca-travis Jun 23, 2018
4408056
[MIG] report_qweb_pdf_watermark: Migration to 11.0
schout-it Aug 16, 2018
ab2f35a
[UPD] Update report_qweb_pdf_watermark.pot
oca-travis Mar 15, 2019
9bff33c
Update translation files
oca-transbot Mar 17, 2019
262f3e4
[MIG] report_qweb_pdf_watermark: Migration to 12.0
robin5210 Nov 18, 2019
319aa69
[UPD] Update report_qweb_pdf_watermark.pot
oca-travis Jan 9, 2020
19ed428
Update translation files
oca-transbot Jan 23, 2020
3468ebf
Update translation files
oca-transbot Aug 16, 2020
54a8425
[FIX] Fix 'installable' syntax in manifest file
mstuttgart Oct 9, 2020
fc810a0
report_qweb_pdf_watermark 12.0.1.0.1
OCA-git-bot Oct 13, 2020
7613b5b
[13.0][MIG] report_qweb_pdf_watermark
fshah-initos Jan 28, 2021
9a57a4b
[IMP] report_qweb_pdf_watermark: black, isort, prettier
fshah-initos Jan 29, 2021
c3ff577
[14.0][MIG] report_qweb_pdf_watermark
fshah-initos Jan 29, 2021
f8140d5
[UPD] Update report_qweb_pdf_watermark.pot
oca-travis Apr 14, 2021
7f64664
[UPD] README.rst
OCA-git-bot Apr 14, 2021
dc33a38
[REF] report_qweb_pdf_watermark: remove PyPDF2 from
fernandahf Jun 1, 2022
0c81eb2
report_qweb_pdf_watermark 14.0.1.0.1
OCA-git-bot Jun 1, 2022
efdee88
[MIG] report_qweb_pdf_watermark: Migration to 15.0
bosd Nov 1, 2022
9b58f88
[UPD] Update report_qweb_pdf_watermark.pot
Dec 29, 2022
d832c05
[UPD] README.rst
OCA-git-bot Dec 29, 2022
411c60f
Update translation files
weblate Dec 29, 2022
5192801
[MIG] report_qweb_pdf_watermark: Migration to 16.0
bvanjeelharia Mar 13, 2023
7ec8e41
[UPD] Update report_qweb_pdf_watermark.pot
Apr 4, 2023
dec1574
[UPD] README.rst
OCA-git-bot Apr 4, 2023
f02a1cf
Update translation files
weblate Apr 5, 2023
ab0e0ac
[IMP] Avoiding ERROR in log with tests of report_qweb_pdf_watermark
BT-rmartin Aug 25, 2023
dc0f36e
Translated using Weblate (Spanish)
Ivorra78 Aug 23, 2023
9adfd19
[UPD] README.rst
OCA-git-bot Sep 3, 2023
b8fda5a
[IMP] report_qweb_pdf_watermark: black, isort, prettier
sanderlienaerts Jan 12, 2024
cfdeadc
[MIG] report_qweb_pdf_watermark: Migration to 17.0
sanderlienaerts Jan 12, 2024
5db398d
[UPD] Update report_qweb_pdf_watermark.pot
Nov 26, 2024
7a65fae
[BOT] post-merge updates
OCA-git-bot Nov 26, 2024
c190a2f
Translated using Weblate (Italian)
mymage Nov 27, 2024
012e877
[IMP] report_qweb_pdf_watermark: pre-commit execution
bosd Jan 5, 2025
1a63b84
[MIG] report_qweb_pdf_watermark: Migration to 18.0
bosd Jan 5, 2025
3a2afc9
[FIX] report_qweb_pdf_watermark: Recursion Error
bosd Jan 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[14.0][MIG] report_qweb_pdf_watermark
fshah-initos authored and bosd committed Jan 5, 2025
commit c3ff577a9308555dd6c2f6a52b4455cf44922d7f
5 changes: 5 additions & 0 deletions report_qweb_pdf_watermark/README.rst
Original file line number Diff line number Diff line change
@@ -67,6 +67,11 @@ Changelog

* [MIG] Migration to V13.

14.0.1.0.0 (2021-01-29)
~~~~~~~~~~~~~~~~~~~~~~~

* [MIG] Migration to V14.

Bug Tracker
===========

2 changes: 1 addition & 1 deletion report_qweb_pdf_watermark/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# © 2016 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import models # pyflakes.ignore
from . import models
54 changes: 30 additions & 24 deletions report_qweb_pdf_watermark/demo/report.xml
Original file line number Diff line number Diff line change
@@ -1,28 +1,34 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<report
id="demo_report"
string="Demo report"
model="res.users"
report_type="qweb-pdf"
name="report_qweb_pdf_watermark.demo_report_view"
file="report_qweb_pdf_watermark.demo_report_view"
paperformat="base.paperformat_euro"
/>
<record id="demo_report" model="ir.actions.report">
<field name="pdf_watermark_expression">docs[:1].company_id.logo</field>
</record>
<template id="demo_report_view">
<t t-call="web.html_container">
<t t-call="web.external_layout">
<div class="page">
<ul>
<li t-foreach="docs" t-as="doc">
<t t-esc="doc.name" />
</li>
</ul>
</div>
<data>
<record id="demo_reports" model="ir.actions.report">
<field name="name">Demo report</field>
<field name="model">res.users</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">report_qweb_pdf_watermark.demo_report_view</field>
<field name="report_file">report_qweb_pdf_watermark.demo_report_view</field>
<field name="paperformat_id" ref="base.paperformat_euro" />
<field name="binding_model_id" ref="base.model_res_users" />
<field name="binding_type">report</field>
</record>
<record id="demo_report" model="ir.actions.report">
<field name="name">Demo report</field>
<field name="model">res.users</field>
<field name="report_name">report_qweb_pdf_watermark.demo_report_view</field>
<field name="pdf_watermark_expression">docs[:1].company_id.logo</field>
</record>
<template id="demo_report_view">
<t t-call="web.html_container">
<t t-call="web.external_layout">
<div class="page">
<ul>
<li t-foreach="docs" t-as="doc">
<t t-esc="doc.name" />
</li>
</ul>
</div>
</t>
</t>
</t>
</template>
</template>
</data>
</odoo>
11 changes: 6 additions & 5 deletions report_qweb_pdf_watermark/models/report.py
Original file line number Diff line number Diff line change
@@ -6,7 +6,8 @@

from PIL import Image

from odoo import api, fields, models, tools
from odoo import api, fields, models
from odoo.tools.safe_eval import safe_eval

try:
# we need this to be sure PIL has loaded PDF support
@@ -34,12 +35,12 @@ class Report(models.Model):
"You have access to variables `env` and `docs`",
)

def render_qweb_pdf(self, res_ids=None, data=None):
def _render_qweb_pdf(self, res_ids=None, data=None):
if not self.env.context.get("res_ids"):
return super(Report, self.with_context(res_ids=res_ids)).render_qweb_pdf(
return super(Report, self.with_context(res_ids=res_ids))._render_qweb_pdf(
res_ids=res_ids, data=data
)
return super(Report, self).render_qweb_pdf(res_ids=res_ids, data=data)
return super(Report, self)._render_qweb_pdf(res_ids=res_ids, data=data)

@api.model
def _run_wkhtmltopdf(
@@ -65,7 +66,7 @@ def _run_wkhtmltopdf(
if self.pdf_watermark:
watermark = b64decode(self.pdf_watermark)
elif docids:
watermark = tools.safe_eval(
watermark = safe_eval(
self.pdf_watermark_expression or "None",
dict(env=self.env, docs=self.env[self.model].browse(docids)),
)
1 change: 1 addition & 0 deletions report_qweb_pdf_watermark/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -2,3 +2,4 @@
* Stefan Rijnhart <stefan@opener.am>
* Rod Schouteden <rod.schouteden@dynapps.be>
* Robin Goots <robin.goots@dynapps.be>
* Foram Shah <foram.shah@initos.com>
12 changes: 12 additions & 0 deletions report_qweb_pdf_watermark/readme/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -2,3 +2,15 @@
~~~~~~~~~~~~~~~~~~~~~~~

* [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.
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ def _test_report_images(self, 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(
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)