[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) <bon@odoo.com>
This commit is contained in:
Nasreddin Boulif (bon)
2023-02-02 03:19:43 +01:00
parent dd2fdcef05
commit 556b1b656d
@@ -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;
}