[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) <lba@odoo.com>
Signed-off-by: Solan Delvenne (sode) <sode@odoo.com>
This commit is contained in:
Solan Delvenne (sode)
2023-12-15 18:28:41 +00:00
parent bcfd1491db
commit 93064e011d
2 changed files with 47 additions and 57 deletions
@@ -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;
}
}
}
@@ -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