From b77cf4073fe7f1cb7203ed1b12f9a6c3b876c56c Mon Sep 17 00:00:00 2001 From: Stefan Rijnhart Date: Wed, 28 Feb 2018 15:40:35 +0100 Subject: [PATCH] [FIX] Don't break printing some upstream reports with invalid models When no background configuration is present on the report definition, don't try to browse the report model especially because this breaks some upstream reports (see https://github.com/odoo/odoo/pull/23389) --- report_qweb_pdf_watermark/__manifest__.py | 2 +- report_qweb_pdf_watermark/models/report.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/report_qweb_pdf_watermark/__manifest__.py b/report_qweb_pdf_watermark/__manifest__.py index d11b8493..f4ca0611 100644 --- a/report_qweb_pdf_watermark/__manifest__.py +++ b/report_qweb_pdf_watermark/__manifest__.py @@ -3,7 +3,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { "name": "Pdf watermark", - "version": "10.0.1.0.1", + "version": "10.0.1.0.2", "author": "Therp BV, " "Odoo Community Association (OCA)", "license": "AGPL-3", diff --git a/report_qweb_pdf_watermark/models/report.py b/report_qweb_pdf_watermark/models/report.py index cc89490b..f77ed759 100644 --- a/report_qweb_pdf_watermark/models/report.py +++ b/report_qweb_pdf_watermark/models/report.py @@ -34,9 +34,9 @@ class Report(models.Model): watermark = None if report.pdf_watermark: watermark = b64decode(report.pdf_watermark) - else: + elif report.pdf_watermark_expression: watermark = tools.safe_eval( - report.pdf_watermark_expression or 'None', + report.pdf_watermark_expression, dict(env=self.env, docs=self.env[report.model].browse(docids)), ) if watermark: