[FIX] l10n_ch: don't add an empty page on QR-bill pdf report when a header is displayed
Before that, just one pixel from the bottom of the QR-bill frame passed got out of the page, and end out creating a second, empty page. Since this error was probably due to some rounding issue in the way A4 dimensions were compared to the layout specified by the scss file, we solve it by rounding the height of this section a little more, removing 0.25mm from it. [FIX] l10n_ch: qr bill report: display the payment ref under "reference" and the invoice's name as additional information closes odoo/odoo#53453 X-original-commit: 8a6cc1a572cd04f540e4a5e83362319c13274aea Signed-off-by: Laurent Smet <smetl@users.noreply.github.com> Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
This commit is contained in:
@@ -219,3 +219,16 @@ class AccountMove(models.Model):
|
||||
"""
|
||||
self.ensure_one()
|
||||
return self.l10n_ch_isr_number
|
||||
|
||||
@api.model
|
||||
def space_qrr_reference(self, qrr_ref):
|
||||
""" Makes the provided QRR reference human-friendly, spacing its elements
|
||||
by blocks of 5 from right to left.
|
||||
"""
|
||||
spaced_qrr_ref = ''
|
||||
i = len(qrr_ref) # i is the index after the last index to consider in substrings
|
||||
while i > 0:
|
||||
spaced_qrr_ref = qrr_ref[max(i-5, 0) : i] + ' ' + spaced_qrr_ref
|
||||
i -= 5
|
||||
|
||||
return spaced_qrr_ref
|
||||
|
||||
@@ -12,7 +12,7 @@ class ReportSwissQR(models.AbstractModel):
|
||||
|
||||
qr_code_urls = {}
|
||||
for invoice in docs:
|
||||
qr_code_urls[invoice.id] = invoice.invoice_partner_bank_id.build_qr_code_url(invoice.amount_residual, invoice.ref or invoice.name, invoice.payment_reference, invoice.currency_id, invoice.partner_id, qr_method='ch_qr', silent_errors=False)
|
||||
qr_code_urls[invoice.id] = invoice.partner_bank_id.build_qr_code_url(invoice.amount_residual, invoice.ref or invoice.name, invoice.payment_reference, invoice.currency_id, invoice.partner_id, qr_method='ch_qr', silent_errors=False)
|
||||
|
||||
return {
|
||||
'doc_ids': docids,
|
||||
|
||||
@@ -43,12 +43,9 @@
|
||||
<span class="swissqr_text content" t-field="o.company_id.zip"/>
|
||||
<span class="swissqr_text content" t-field="o.company_id.city"/><br/>
|
||||
|
||||
<span class="swissqr_text title">Reference</span><br/>
|
||||
<t t-if="o.partner_bank_id.currency_id.name == 'EUR'">
|
||||
<span class="swissqr_text content" t-field="o.partner_bank_id.bank_id.l10n_ch_postal_eur"/><br/>
|
||||
</t>
|
||||
<t t-if="o.partner_bank_id.currency_id.name == 'CHF'">
|
||||
<span class="swissqr_text content" t-field="o.partner_bank_id.bank_id.l10n_ch_postal_chf"/><br/>
|
||||
<t t-if="o.partner_bank_id._is_qr_iban()">
|
||||
<span class="swissqr_text title">Reference</span><br/>
|
||||
<span class="swissqr_text content" t-esc="o.space_qrr_reference(o.payment_reference)"/><br/>
|
||||
</t>
|
||||
|
||||
<span class="swissqr_text title">Payable by</span><br/>
|
||||
@@ -88,16 +85,15 @@
|
||||
<span class="swissqr_text content" t-field="o.company_id.zip"/>
|
||||
<span class="swissqr_text content" t-field="o.company_id.city"/><br/>
|
||||
|
||||
<span class="swissqr_text title">Reference</span><br/>
|
||||
<t t-if="o.partner_bank_id.currency_id.name == 'EUR'">
|
||||
<span class="swissqr_text content" t-field="o.partner_bank_id.l10n_ch_isr_subscription_eur"/><br/>
|
||||
</t>
|
||||
<t t-if="o.partner_bank_id.currency_id.name == 'CHF'">
|
||||
<span class="swissqr_text content" t-field="o.partner_bank_id.l10n_ch_isr_subscription_chf"/><br/>
|
||||
<t t-if="o.partner_bank_id._is_qr_iban()">
|
||||
<span class="swissqr_text title">Reference</span><br/>
|
||||
<span class="swissqr_text content" t-esc="o.space_qrr_reference(o.payment_reference)"/><br/>
|
||||
</t>
|
||||
|
||||
<span class="swissqr_text title">Additional information</span><br/>
|
||||
<span class="swissqr_text content" t-field="o.ref"/><br/>
|
||||
<span class="swissqr_text content" t-esc="o.payment_reference or o.ref or o.name" t-if="not o.partner_bank_id._is_qr_iban()"/>
|
||||
<span class="swissqr_text content" t-esc="o.ref or o.name" t-if="o.partner_bank_id._is_qr_iban()"/>
|
||||
<br/>
|
||||
|
||||
<span class="swissqr_text title">Payable by</span><br/>
|
||||
<span class="swissqr_text content" t-field="o.partner_id.name"/><br/>
|
||||
|
||||
@@ -14,7 +14,7 @@ body.l10n_ch_qr {
|
||||
}
|
||||
|
||||
.swissqr_content {
|
||||
position: relative;
|
||||
position: static;
|
||||
}
|
||||
|
||||
.swissqr_receipt {
|
||||
@@ -23,7 +23,7 @@ body.l10n_ch_qr {
|
||||
border-color:black;
|
||||
border-width: 1pt 1pt 1pt 1pt;
|
||||
border-style: solid;
|
||||
height: 131.25mm; /* 105 * 1.25 */
|
||||
height: 131mm; /* 105 * 1.25 - 0.25 mm to cope for rendering issues due to header (probably a rounding issue) */
|
||||
width: 77.5mm; /* 62 * 1.25 */
|
||||
top: 240mm; /* 192 * 1.25 */
|
||||
left: 0mm;
|
||||
@@ -36,7 +36,7 @@ body.l10n_ch_qr {
|
||||
border-color:black;
|
||||
border-width: 1pt 1pt 1pt 1pt;
|
||||
border-style: solid;
|
||||
height: 131.25mm; /* 105 * 1.25 */
|
||||
height: 131mm; /* 105 * 1.25 - 0.25mm to cope for rendering issues due to header (probably a rounding issue)*/
|
||||
width: 185mm; /* 148 * 1.25 */
|
||||
top: 240mm; /* 192 * 1.25 */
|
||||
left: 77.5mm; /* 62 * 1.25 */
|
||||
|
||||
Reference in New Issue
Block a user