Skip to content

Commit

Permalink
Reformatting
Browse files Browse the repository at this point in the history
  • Loading branch information
TimoFiebelkornSAMSAIT committed Feb 27, 2024
1 parent 3d84bf8 commit 083255c
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions report_qweb_pdf_watermark/models/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,24 @@ class Report(models.Model):
pdf_watermark_expression = fields.Char(
"Watermark expression",
help="An expression yielding the base64 "
"encoded data to be used as watermark. \n"
"You have access to variables `env` and `docs`",
"encoded data to be used as watermark. \n"
"You have access to variables `env` and `docs`",
)

def _render_qweb_pdf(self, report_ref, res_ids=None, data=None):
original_report_ref = report_ref
if 'duplicate' in report_ref:
report_ref = report_ref.split('_duplicate')[0]
if "duplicate" in report_ref:
report_ref = report_ref.split("_duplicate")[0]

Check warning on line 48 in report_qweb_pdf_watermark/models/report.py

View check run for this annotation

Codecov / codecov/patch

report_qweb_pdf_watermark/models/report.py#L48

Added line #L48 was not covered by tests
if not self.env.context.get("res_ids"):
return super(Report, self.with_context(res_ids=res_ids, original_report_ref=original_report_ref))._render_qweb_pdf(
report_ref, res_ids=res_ids, data=data
)
return super(Report, self.with_context(original_report_ref=original_report_ref))._render_qweb_pdf(
report_ref, res_ids=res_ids, data=data
)
return super(
Report,
self.with_context(
res_ids=res_ids, original_report_ref=original_report_ref
),
)._render_qweb_pdf(report_ref, res_ids=res_ids, data=data)
return super(

Check warning on line 56 in report_qweb_pdf_watermark/models/report.py

View check run for this annotation

Codecov / codecov/patch

report_qweb_pdf_watermark/models/report.py#L56

Added line #L56 was not covered by tests
Report, self.with_context(original_report_ref=original_report_ref)
)._render_qweb_pdf(report_ref, res_ids=res_ids, data=data)

def pdf_has_usable_pages(self, numpages):
if numpages < 1:
Expand Down Expand Up @@ -89,7 +92,9 @@ def _run_wkhtmltopdf(
docids = self.env.context.get("res_ids", False)
report_sudo = self._get_report(report_ref)
if self.env.context.get("original_report_ref"):
original_report_sudo = self._get_report(self.env.context.get("original_report_ref"))
original_report_sudo = self._get_report(
self.env.context.get("original_report_ref")
)
if original_report_sudo:
report_sudo = original_report_sudo
watermark = None
Expand Down

0 comments on commit 083255c

Please sign in to comment.