From c8b9e70ced543e89e00c6f7a04ba752f4e6c13df Mon Sep 17 00:00:00 2001 From: "Solan Delvenne (sode)" Date: Thu, 8 Dec 2022 12:19:01 +0000 Subject: [PATCH] [FIX] snailmail: fix follow-up reports layout for snailmails Follow-up reports were previously not handled by the commit fixing invoices. This commit aims to fix that. closes odoo/odoo#107787 X-original-commit: 768cfbe095cd6757771dcc683637fd510b0fbddb Signed-off-by: Florian Daloze (fda) Signed-off-by: Solan Delvenne (sode) --- .../src/js/snailmail_external_layout.js | 6 ++++- .../scss/snailmail_external_layout_asset.scss | 25 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/addons/snailmail/static/src/js/snailmail_external_layout.js b/addons/snailmail/static/src/js/snailmail_external_layout.js index d03ce05fa86..f6533e3d6be 100644 --- a/addons/snailmail/static/src/js/snailmail_external_layout.js +++ b/addons/snailmail/static/src/js/snailmail_external_layout.js @@ -1,8 +1,12 @@ // Change address font-size if needed document.addEventListener('DOMContentLoaded', function (evt) { var recipientAddress = document.querySelector(".address.row > div[name='address'] > address"); + let baseSize = 120; + if (!recipientAddress) { + recipientAddress = document.querySelector("div .row.fallback_header > div.col-5.offset-7 > div:first-child"); + } var style = window.getComputedStyle(recipientAddress, null); var height = parseFloat(style.getPropertyValue('height')); var fontSize = parseFloat(style.getPropertyValue('font-size')); - recipientAddress.style.fontSize = (130 / (height / fontSize)) + 'px'; + recipientAddress.style.fontSize = (baseSize / (height / fontSize)) + 'px'; }); diff --git a/addons/snailmail/static/src/scss/snailmail_external_layout_asset.scss b/addons/snailmail/static/src/scss/snailmail_external_layout_asset.scss index 5024f35261a..fbe5d7a7759 100644 --- a/addons/snailmail/static/src/scss/snailmail_external_layout_asset.scss +++ b/addons/snailmail/static/src/scss/snailmail_external_layout_asset.scss @@ -38,3 +38,28 @@ div .address.row > div[name="address"] { max-height: 33mm; } } + +/* Follow-up Letters */ +div .pt-5:empty { + display: none; +} + +div .row.fallback_header { + margin-top: -4mm !important; + height: 68mm !important; + width: 117% !important; + > div .col-5.offset-7 { + background-color: #ffffff; + margin-left: 48.5% !important; + position: relative !important; + > div:first-child { + width: 100%; + padding-left: 2mm !important; + height: 33mm; + max-height: 33mm !important; + line-height: 1.1em; + position: absolute; + bottom: 0; + } + } +}