Skip to content

Commit

Permalink
[IMP] report_qweb_pdf: Backport to 14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ntsirintanis committed Jan 13, 2025
1 parent e2d4f1d commit 00b4c22
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 28 deletions.
10 changes: 5 additions & 5 deletions report_qweb_pdf_cover/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Report QWeb PDF Cover
: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_cover
:target: https://github.com/OCA/reporting-engine/tree/14.0/report_qweb_pdf_cover
: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_cover
:target: https://translation.odoo-community.org/projects/reporting-engine-14-0/reporting-engine-14-0-report_qweb_pdf_cover
: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=14.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -67,7 +67,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_cover%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_cover%0Aversion:%2014.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.

Expand Down Expand Up @@ -97,6 +97,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_cover>`_ project on GitHub.
This module is part of the `OCA/reporting-engine <https://github.com/OCA/reporting-engine/tree/14.0/report_qweb_pdf_cover>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion report_qweb_pdf_cover/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"author": "ForgeFlow, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/reporting-engine",
"category": "Reporting",
"version": "16.0.1.0.0",
"version": "14.0.1.0.0",
"license": "AGPL-3",
"depends": ["web"],
"data": ["views/ir_actions_views.xml"],
Expand Down
23 changes: 8 additions & 15 deletions report_qweb_pdf_cover/models/ir_actions_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,13 @@ def pdf_check_pages(self, num_pages, front=True):
)
return True

Check warning on line 72 in report_qweb_pdf_cover/models/ir_actions_report.py

View check run for this annotation

Codecov / codecov/patch

report_qweb_pdf_cover/models/ir_actions_report.py#L72

Added line #L72 was not covered by tests

def load_covers(
self, report_sudo, front_cover, back_cover, use_front_cover, use_back_cover
):
def load_covers(self, front_cover, back_cover, use_front_cover, use_back_cover):
if use_front_cover:
front_cover_pdf = self.front_cover_pdf or report_sudo.front_cover_pdf
front_cover_pdf = self.front_cover_pdf

Check warning on line 76 in report_qweb_pdf_cover/models/ir_actions_report.py

View check run for this annotation

Codecov / codecov/patch

report_qweb_pdf_cover/models/ir_actions_report.py#L76

Added line #L76 was not covered by tests
if front_cover_pdf:
front_cover = b64decode(front_cover_pdf)

Check warning on line 78 in report_qweb_pdf_cover/models/ir_actions_report.py

View check run for this annotation

Codecov / codecov/patch

report_qweb_pdf_cover/models/ir_actions_report.py#L78

Added line #L78 was not covered by tests
if use_back_cover:
back_cover_pdf = self.back_cover_pdf or report_sudo.back_cover_pdf
back_cover_pdf = self.back_cover_pdf

Check warning on line 80 in report_qweb_pdf_cover/models/ir_actions_report.py

View check run for this annotation

Codecov / codecov/patch

report_qweb_pdf_cover/models/ir_actions_report.py#L80

Added line #L80 was not covered by tests
if back_cover_pdf:
back_cover = b64decode(back_cover_pdf)
return front_cover, back_cover

Check warning on line 83 in report_qweb_pdf_cover/models/ir_actions_report.py

View check run for this annotation

Codecov / codecov/patch

report_qweb_pdf_cover/models/ir_actions_report.py#L82-L83

Added lines #L82 - L83 were not covered by tests
Expand Down Expand Up @@ -147,7 +145,6 @@ def insert_cover_pages(
def _run_wkhtmltopdf(
self,
bodies,
report_ref=False,
header=None,
footer=None,
landscape=False,
Expand All @@ -156,28 +153,24 @@ def _run_wkhtmltopdf(
):
result = super()._run_wkhtmltopdf(
bodies,
report_ref=report_ref,
header=header,
footer=footer,
landscape=landscape,
specific_paperformat_args=specific_paperformat_args,
set_viewport_size=set_viewport_size,
)

report_sudo = self._get_report(report_ref)
front_cover = False
back_cover = False
use_front_cover = self.use_front_cover or report_sudo.use_front_cover
use_back_cover = self.use_back_cover or report_sudo.use_back_cover
front_cover_overlap = (
self.front_cover_overlap or report_sudo.front_cover_overlap
)
back_cover_overlap = self.back_cover_overlap or report_sudo.back_cover_overlap
use_front_cover = self.use_front_cover
use_back_cover = self.use_back_cover
front_cover_overlap = self.front_cover_overlap
back_cover_overlap = self.back_cover_overlap
if not use_front_cover and not use_back_cover:
return result

front_cover, back_cover = self.load_covers(

Check warning on line 172 in report_qweb_pdf_cover/models/ir_actions_report.py

View check run for this annotation

Codecov / codecov/patch

report_qweb_pdf_cover/models/ir_actions_report.py#L172

Added line #L172 was not covered by tests
report_sudo, front_cover, back_cover, use_front_cover, use_back_cover
front_cover, back_cover, use_front_cover, use_back_cover
)
if not front_cover and not back_cover:
return result

Check warning on line 176 in report_qweb_pdf_cover/models/ir_actions_report.py

View check run for this annotation

Codecov / codecov/patch

report_qweb_pdf_cover/models/ir_actions_report.py#L176

Added line #L176 was not covered by tests
Expand Down
17 changes: 10 additions & 7 deletions report_qweb_pdf_cover/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -274,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -300,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -368,7 +369,7 @@ <h1 class="title">Report QWeb PDF Cover</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:1287ee62d703ed048f33bb706f289cf01e5c99bead22b8b612d69e88071a4d67
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.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_cover"><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_cover"><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><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.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/14.0/report_qweb_pdf_cover"><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-14-0/reporting-engine-14-0-report_qweb_pdf_cover"><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=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allows for front and back covers to be added to the generated PDF
reports. They can be added as a separate page, at the beginning or the end of
the report, but they can also overlap the first and last page of the actual
Expand Down Expand Up @@ -410,7 +411,7 @@ <h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
<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_cover%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_cover%0Aversion:%2014.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">
Expand All @@ -430,11 +431,13 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<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_cover">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/14.0/report_qweb_pdf_cover">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>
Expand Down

0 comments on commit 00b4c22

Please sign in to comment.