From e8367f2df8c10d6813454ef0d324d5965c356371 Mon Sep 17 00:00:00 2001 From: clesgow Date: Fri, 23 Sep 2022 11:12:34 +0000 Subject: [PATCH] [FIX] web: Bootstrap 5 vs wkhtmltopdf incompatibilites MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In Bootstrap 5, the `container` class was updated to use variables for its left/right paddings. This seems to conflict with wkhtmltopdf, and no paddings are added, shifting all reports. This introduces the set paddings defined in Bootstrap 4 for the reports. Steps to reproduce: Go to Inventory -> Products -> Products -> Any consumable/storable product -> Print labels -> Dymo Also with Bootstrap 5, the `table-borderless` class wasn't working properly on the PDFs either, as the borders were still visible. This removes all borders within a `table-borderless`. Steps to reproduce: Go to Inventory -> Products -> Products -> Any consumable/storable product -> Print labels -> 2x7 with price Part of task-2985735 closes odoo/odoo#101490 X-original-commit: 0b9acefb18ad8b4a0df72789c853ed8d113a495b Signed-off-by: Adrien Dieudonné (adr) --- .../reports/bootstrap_overridden_report.scss | 1 + .../src/webclient/actions/reports/report.scss | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/addons/web/static/src/webclient/actions/reports/bootstrap_overridden_report.scss b/addons/web/static/src/webclient/actions/reports/bootstrap_overridden_report.scss index b5959aa8d2a..513ac281b80 100644 --- a/addons/web/static/src/webclient/actions/reports/bootstrap_overridden_report.scss +++ b/addons/web/static/src/webclient/actions/reports/bootstrap_overridden_report.scss @@ -1,4 +1,5 @@ $link-decoration: none !default; +$container-padding-x: 15px; // Like in BS4 // remove Emoji fonts $font-family-sans-serif: o-add-unicode-support-font(("Lucida Grande", Helvetica, Verdana, Arial, sans-serif), 1); diff --git a/addons/web/static/src/webclient/actions/reports/report.scss b/addons/web/static/src/webclient/actions/reports/report.scss index 95c0b6e2814..c0509d11895 100644 --- a/addons/web/static/src/webclient/actions/reports/report.scss +++ b/addons/web/static/src/webclient/actions/reports/report.scss @@ -119,3 +119,16 @@ ol { -webkit-box-flex: 1 !important; width: 100% !important; } + +// Boostrap 5 introduces variable paddings for container which wkhtmltopdf doesn't seem to process, so we restore Boostrap 4's paddings for PDFs +.container { + padding-right: $container-padding-x; + padding-left: $container-padding-x; +} + +// Removes borders within a table-borderless as its new definition in Boostrap 5 still has its borders visible in PDFs +.table-borderless { + tbody, thead, tfoot, tr, td, th { + border: 0 none; + } +}