From 556b1b656dcdeaab85857b3d23b4e994e94050aa Mon Sep 17 00:00:00 2001 From: "Nasreddin Boulif (bon)" Date: Tue, 24 Jan 2023 14:45:39 +0000 Subject: [PATCH] [FIX] survey: fix print of survey results Steps to reproduce (Using Chromium-based browser > v. 108): - Install Survey module - Open 'Feedback Form' survey - Click on 'See Results' button - Try to print the 'results' of 'Feedback Form' Issues: - Hundreds of empty pages added when printing. - Chart not fully displayed. Cause: - The chartjs library add some HTML elements not displayed (inside div with class `chartjs-size-monitor`) to handle the resizing of the chart canvas. One of the element has a width and height of 1000000px with an overflow:hidden, but the overflow does not work properly when printing. (Issue introduced in Chrome v. 108, working fine in v. 107 or on any Firefox version) - The chart canvas is not resized to 100% of its parent container and therefore not fully displayed. (Not working in all Chrome and Firefox versions) Solution: (in print media rule) Add CSS : - Set style to `display: none` on `chartjs-size-monitor` HTML element. - Set the width and height of the chart canvas to 100%. Remove css that set a fixed max-width on the parent element of the chart canvas parent. opw-3109523 closes odoo/odoo#111640 X-original-commit: a3fd499b1cd1416093d1f4348302f090b0f38554 Signed-off-by: Nasreddin Boulif (bon) --- .../static/src/scss/survey_templates_results.scss | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/addons/survey/static/src/scss/survey_templates_results.scss b/addons/survey/static/src/scss/survey_templates_results.scss index a7de7bfec9c..b74b2f9bea2 100644 --- a/addons/survey/static/src/scss/survey_templates_results.scss +++ b/addons/survey/static/src/scss/survey_templates_results.scss @@ -1,10 +1,14 @@ @media print { + .chartjs-size-monitor { + display: none; + } + .chartjs-render-monitor { + width: 100% !important; + height: 100% !important; + } .tab-content > .tab-pane { display: block; } - .tab-content > .survey_graph { - max-width: 768px; - } html { height: unset; }