From a66c6006c39dd609cd6bbfc382640f05e2e8c4c0 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Wed, 9 Aug 2023 09:34:34 +0200 Subject: [PATCH] [FIX] web: accept is_html_empty in layout wizard Scenario: - edit the current document layout and use is_html_empty method in it - it works in Preview Document, when printing any report, ... => it breaks when opening document layout wizard by clicking on "Configure Document Layout" Reason: is_html_empty was added to _get_rendering_context, but the preview instead the document layout wizard doesn't use this method. Fix: add is_html_empty in the context opw-3433583 closes odoo/odoo#133122 X-original-commit: 5f1ad0c1e4c1e8ed41337ccd4c12e70c9c760c85 Signed-off-by: Nicolas Lempereur (nle) --- addons/web/models/base_document_layout.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/web/models/base_document_layout.py b/addons/web/models/base_document_layout.py index 4921124cbbf..7483339a310 100644 --- a/addons/web/models/base_document_layout.py +++ b/addons/web/models/base_document_layout.py @@ -6,7 +6,7 @@ from odoo import api, fields, models, tools from odoo.addons.base.models.ir_qweb_fields import nl2br from odoo.modules import get_resource_path -from odoo.tools import html2plaintext +from odoo.tools import html2plaintext, is_html_empty try: import sass as libsass @@ -133,7 +133,11 @@ class BaseDocumentLayout(models.TransientModel): wizard_with_logo = wizard preview_css = markupsafe.Markup(self._get_css_for_preview(styles, wizard_with_logo.id)) ir_ui_view = wizard_with_logo.env['ir.ui.view'] - wizard.preview = ir_ui_view._render_template('web.report_invoice_wizard_preview', {'company': wizard_with_logo, 'preview_css': preview_css}) + wizard.preview = ir_ui_view._render_template('web.report_invoice_wizard_preview', { + 'company': wizard_with_logo, + 'preview_css': preview_css, + 'is_html_empty': is_html_empty, + }) else: wizard.preview = False