From 93064e011da97982d0ab8701126fc59f4df31a3e Mon Sep 17 00:00:00 2001 From: "Solan Delvenne (sode)" Date: Thu, 7 Dec 2023 10:02:12 +0100 Subject: [PATCH] [FIX] snailmail, snailmail_account: Fix broken letters rendering Snailmail letters failed to fail in newer version of Odoo. The cause is a report attachment was supplied at the creation of the letter, preventing the snailmail module to generate the report with the required CSS. Said CSS was also rewritten to be clearer and to fix the follow up reports. closes odoo/odoo#146525 X-original-commit: 87c90abaec701cfa0e29391b52780e4c2b9e4694 Signed-off-by: Louis Baudoux (lba) Signed-off-by: Solan Delvenne (sode) --- .../scss/snailmail_external_layout_asset.scss | 102 ++++++++---------- .../wizard/account_move_send.py | 2 +- 2 files changed, 47 insertions(+), 57 deletions(-) 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 95f475a3f4f..8b74bb60152 100644 --- a/addons/snailmail/static/src/scss/snailmail_external_layout_asset.scss +++ b/addons/snailmail/static/src/scss/snailmail_external_layout_asset.scss @@ -1,64 +1,54 @@ -/*Modifications for the Standard and Boxed document layouts */ -.article.o_report_layout_standard.o_company_1_layout, .article.o_report_layout_boxed.o_company_1_layout { - > .pt-5 { - padding-top: 0 !important; - > .address.row { - width: 117% !important; - height: 68mm !important; - margin-top: -4mm !important; - line-height: 1.1em; - } - } -} - -/*Modifications for Bold and Striped document layouts*/ -.article.o_report_layout_bold.o_company_1_layout, .article.o_report_layout_striped.o_company_1_layout { - > .address.row { - width: 117% !important; - height: 68mm !important; - margin-top: -4mm !important; - line-height: 1.1em; - } -} - -/* Modifications for all layouts */ -div .address.row > div[name="address"] { - position: relative !important; - margin-left: 47.5% !important; - background-color: #ffffff; - > address { - width: 100% !important; - position: absolute !important; - bottom: 0 !important; - padding-left: 5mm; - padding-top: 3mm; - height: 33mm; - max-height: 33mm; - } -} - +/* Fix header height */ div .header.o_company_1_layout > div[class$="_header"] { overflow: hidden !important; max-height: 150px; } -/* Follow-up Letters */ -div .row.fallback_header { - margin-top: -4mm !important; - height: 68mm !important; - width: 117% !important; - > div.col-5.offset-7 { - background-color: #ffffff; - margin-left: 47.5% !important; - position: relative !important; - > div:first-child { - width: 100%; - padding-left: 6mm !important; - height: 33mm; - max-height: 33mm !important; - line-height: 1.1em; - position: absolute; - bottom: 0; +/*Modifications for the Standard and Boxed document layouts */ +.article.o_report_layout_standard.o_company_1_layout, .article.o_report_layout_boxed.o_company_1_layout { + > .pt-5 { + padding-top: 0 !important; + } +} + +/* Modifications for all layouts */ +div .address.row { + height: 56mm; + max-height: 56mm; + > div[name="address"] { + font-size: 95%; + background-color: #fff; + padding-top: 25mm; + padding-left: 4mm; + margin-bottom: 2mm; + margin-left: 56% !important; + width: 45.5%; + height: 56mm; + max-height: 56mm; + // Hide VAT number line + > span:not(:first-child) { + display: none; + } + } +} + +/* Follow-up Letters */ +div .row.fallback_header { + height: 56mm; + max-height: 56mm; + > div.col-5.offset-7 { + font-size: 95%; + background-color: #fff; + padding-top: 25mm; + padding-left: 4mm; + margin-bottom: 2mm; + margin-left: 56%; + width: 45.5%; + height: 56mm; + max-height: 56mm; + // Hide VAT number line + > span:not(:first-child) { + display: none; } } } diff --git a/addons/snailmail_account/wizard/account_move_send.py b/addons/snailmail_account/wizard/account_move_send.py index afc14aff3b1..7db98bf732b 100644 --- a/addons/snailmail_account/wizard/account_move_send.py +++ b/addons/snailmail_account/wizard/account_move_send.py @@ -69,7 +69,7 @@ class AccountMoveSend(models.TransientModel): 'res_id': move.id, 'user_id': self.env.user.id, 'company_id': move.company_id.id, - 'attachment_id': move.invoice_pdf_report_id.id, + 'report_template': self.env['ir.actions.report']._get_report('account.account_invoices').id } @api.model