[FIX] l10n_ch - Swiss QR layout cleaning

This intend to enforce specifications and improve readability

Layout changes:

* [FIX] Amount section must be placed under the QR code
* [FIX] Don't display empty additional information
* [FIX] Rename slip sections and labels
* [IMP] Rework of the layout

    Group content like adresse by removing line spacing
    Reduce character size to follow Swiss Implementation Guidelines QR-bill v2.1
    Reduce left margin to avoid overlap of spaced ISR reference on the Receipt

* [FIX] Missing street on Receipt
* [FIX] Add thousand separators

    Official specs asks for:
    - thousand separators as blank. (using a non breaking to avoid spliting the amount)
    - decimal separators as a full stop

    > If  the  amount  isincluded  in  the  Swiss  QR  Code,  then  it  must  be  printed  after  the currency code. A blank (space) should be used as the thousands separator and a full stop «.»as  the  decimal  separator.  The  amount  must  always  include  two  decimal places (e.g. CHF 1 590.00).

QR-Code:

* [IMP] Align QR code upper and improve accuracy of size

    Add an option on reportlab to print QR Code without surounding blank space
    this is required to compute with accuracy the width of 46mm x 46mm defined
    in the specs.

* [FIX] Street and street2 issues

    Removes an extra space between street values when only one is given.
    Test the right partner street, only the company street was checked.

QRR generation

* [FIX] make it possible to generate QRR

    It must be possible to generate QRR without ISR subscription number.

Content removed as not present in the specs version 2.1:

* [RM] procedure section
* [RM] due date

Translations:

* [IMP] Add translations of the QR-bill in DE, FR and IT
* [FIX] QR-bill lang is now based on customer lang

Tests:

* [IMP] Add unit tests for Swiss reality check for the QR-bill

closes odoo/odoo#54053

X-original-commit: 4f4edd0594b29252a5d44281cc773230c09521e9
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
This commit is contained in:
Yannick Vaucher
2020-07-03 13:01:15 +00:00
committed by oco-odoo
parent 28ed951dee
commit 3230ae6441
12 changed files with 530 additions and 394 deletions
+22 -93
View File
@@ -142,38 +142,6 @@ msgstr ""
msgid "910 Les dons, les dividendes, les dédommagements, ..."
msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid ""
"<br/>\n"
"\n"
" <span class=\"swissqr_text title\">Creditor</span><br/>"
msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid ""
"<br/>\n"
"\n"
" <span class=\"swissqr_text title\">Debtor</span><br/>"
msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid ""
"<br/>\n"
"\n"
" <span class=\"swissqr_text title\">Due date</span><br/>"
msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid ""
"<br/>\n"
"\n"
" <span class=\"swissqr_text title\">Reference number</span><br/>"
msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.res_config_settings_view_form
msgid "<span class=\"o_form_label\">ISR scan line offset</span>"
@@ -181,53 +149,52 @@ msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid ""
"<span class=\"swissqr_text title title_zone\">QR-bill payment "
"part</span><br/>"
msgid "<span class=\"title\">Acceptance point</span>"
msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span class=\"swissqr_text title\">Account</span><br/>"
msgid "<span class=\"title\">Additional information</span><br/>"
msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span class=\"swissqr_text title\">Additional information</span><br/>"
msgid "<span class=\"title\">Amount</span><br/>"
msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span class=\"swissqr_text title\">Amount</span><br/>"
msgid "<span class=\"title\">Account / Payable to</span><br/>"
msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span class=\"swissqr_text title\">Currency</span><br/>"
msgid "<span class=\"title\">Currency</span><br/>"
msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid ""
"<span class=\"swissqr_text title\">Supports</span><br/>\n"
" <span class=\"swissqr_text content\">Credit transfer</span>"
msgid "<span class=\"title\">Payable by</span><br/>"
msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid ""
"<span>Some pieces of this information are not set correctly to display the Swiss QR Code.<br/>\n"
" -Bank &gt; CHF ISR subscription<br/>\n"
" -Bank &gt; EUR ISR subscription<br/>\n"
" -Your company &gt; Street with number<br/>\n"
" -Your company &gt; City<br/>\n"
" -Your company &gt; Zip<br/>\n"
" -Your company &gt; Country<br/>\n"
" -Debtor &gt; Street with number<br/>\n"
" -Debtor &gt; City<br/>\n"
" -Debtor &gt; Zip<br/>\n"
" -Debtor &gt; Country\n"
" </span>"
msgid "<span class=\"title\">Payable to</span><br/>"
msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span class=\"title\">Reference</span><br/>"
msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span>Payment Part</span>"
msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span>Receipt</span>"
msgstr ""
#. module: l10n_ch
@@ -601,41 +568,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "QR-bill for invoice"
msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span class=\"swissqr_text title title_zone\">QR-bill Payment Receipt Part</span><br/>\n"
"\n"
" <span class=\"swissqr_text title\">Payable to</span><br/>"
msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span class=\"swissqr_text title\">Payable to</span><br/>"
msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<br/>\n"
"\n"
" <span class=\"swissqr_text title\">Reference</span><br/>"
msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span class=\"swissqr_text title\">Payable by</span><br/>"
msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span class=\"swissqr_text title\">Payable by</span><br/>"
msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span class=\"swissqr_text title\">Acceptance point</span>"
msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span class=\"swissqr_text title title_zone\">QR-bill Payment Part</span><br/>"
+21 -63
View File
@@ -7,8 +7,8 @@ msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-28 09:52+0000\n"
"PO-Revision-Date: 2019-02-12 12:06+0530\n"
"Last-Translator: didier.donze@camptocamp.com\n"
"PO-Revision-Date: 2020-06-17 10:00+0000\n"
"Last-Translator: yannick.vaucher@camptocamp.com\n"
"Language-Team: \n"
"Language: de\n"
"MIME-Version: 1.0\n"
@@ -25,7 +25,7 @@ msgstr ""
#. module: l10n_ch
#: model:ir.actions.report,print_report_name:l10n_ch.l10n_ch_qr_report
msgid "'QR-bill-%s' % object.name"
msgstr ""
msgstr "'QR-Rechnung-%s' % object.name"
#. module: l10n_ch
#: model:account.tax.template,description:l10n_ch.vat_other_movements_910
@@ -328,90 +328,48 @@ msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid ""
"<br/>\n"
"\n"
" <span class=\"swissqr_text title\">Due date</"
"span><br/>"
msgstr ""
msgid "<span class=\"title\">Acceptance point</span>"
msgstr "<span class=\"title\">Annahmestelle</span>"
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid ""
"<br/>\n"
"\n"
" <span class=\"swissqr_text title\">Payable by</"
"span><br/>"
msgstr ""
msgid "<span class=\"title\">Account / Payable to</span><br/>"
msgstr "<span class=\"title\">Konto / Zahlbar an</span><br/>"
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid ""
"<br/>\n"
"\n"
" <span class=\"swissqr_text title\">Reference</"
"span><br/>"
msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.res_config_settings_view_form
msgid "<span class=\"o_form_label\">ISR scan line offset</span>"
msgstr ""
msgid "<span class=\"title\">Additional information</span><br/>"
msgstr "<span class=\"title\">Zusätzliche Informationen</span><br/>"
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid ""
"<span class=\"swissqr_text title title_zone\">QR-bill Payment Part</span><br/"
">"
msgstr ""
msgid "<span class=\"title\">Amount</span><br/>"
msgstr "<span class=\"title\">Betrag</span><br/>"
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid ""
"<span class=\"swissqr_text title title_zone\">QR-bill Payment Receipt Part</"
"span><br/>\n"
"\n"
" <span class=\"swissqr_text title\">Payable to</"
"span><br/>"
msgstr ""
msgid "<span class=\"title\">Currency</span><br/>"
msgstr "<span class=\"title\">Währung</span><br/>"
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span class=\"swissqr_text title\">Acceptance point</span>"
msgstr ""
msgid "<span class=\"title\">Payable by</span><br/>"
msgstr "<span class=\"title\">Zahlbar durch</span><br/>"
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span class=\"swissqr_text title\">Additional information</span><br/>"
msgstr ""
msgid "<span class=\"title\">Reference</span><br/>"
msgstr "<span class=\"title\">Referenz</span><br/>"
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span class=\"swissqr_text title\">Amount</span><br/>"
msgstr ""
msgid "<span>Payment Part</span>"
msgstr "<span>Zahlteil</span>"
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span class=\"swissqr_text title\">Currency</span><br/>"
msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span class=\"swissqr_text title\">Payable by</span><br/>"
msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span class=\"swissqr_text title\">Payable to</span><br/>"
msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid ""
"<span class=\"swissqr_text title\">Supports</span><br/>\n"
" <span class=\"swissqr_text content\">Credit "
"transfer</span>"
msgstr ""
msgid "<span>Receipt</span>"
msgstr "<span>Empfangsschein</span>"
#. module: l10n_ch
#: model:account.tax.report.line,name:l10n_ch.account_tax_report_line_chtax_autres_mouv
+78
View File
@@ -0,0 +1,78 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * l10n_ch
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-28 09:52+0000\n"
"PO-Revision-Date: 2020-06-17 10:00+0000\n"
"Last-Translator: yannick.vaucher@camptocamp.com\n"
"Language-Team: \n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
"X-Generator: Poedit 2.2.1\n"
#. module: l10n_ch
#: model:ir.actions.report,print_report_name:l10n_ch.l10n_ch_qr_report
msgid "'QR-bill-%s' % object.name"
msgstr "'QR-facture-%s' % object.name"
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "QR-bill for invoice"
msgstr "QR-facture"
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.isr_invoice_form
msgid "Print QR-bill"
msgstr "Imprimer QR-facture"
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span class=\"title\">Acceptance point</span>"
msgstr "<span class=\"title\">Point de dépôt</span>"
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span class=\"title\">Account / Payable to</span><br/>"
msgstr "<span class=\"title\">Compte / Payable à</span><br/>"
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span class=\"title\">Additional information</span><br/>"
msgstr "<span class=\"title\">Information supplémentaires</span><br/>"
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span class=\"title\">Amount</span><br/>"
msgstr "<span class=\"title\">Montant</span><br/>"
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span class=\"title\">Currency</span><br/>"
msgstr "<span class=\"title\">Monnaie</span><br/>"
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span class=\"title\">Payable by</span><br/>"
msgstr "<span class=\"title\">Payable par</span><br/>"
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span class=\"title\">Reference</span><br/>"
msgstr "<span class=\"title\">Référence</span><br/>"
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span>Payment Part</span>"
msgstr "<span>Section paiement</span>"
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span>Receipt</span>"
msgstr "<span>Récépissé</span>"
+24 -84
View File
@@ -7,7 +7,7 @@ msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-28 09:52+0000\n"
"PO-Revision-Date: 2020-05-28 14:49+0200\n"
"PO-Revision-Date: 2020-06-17 10:00+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"Language: it\n"
@@ -328,113 +328,48 @@ msgstr "910 Donazioni, dividendi, compensi, ..."
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid ""
"<br/>\n"
"\n"
" <span class=\"swissqr_text title\">Due date</"
"span><br/>"
msgstr ""
"<br/>\n"
"\n"
" <span class=\"swissqr_text title\">Data di "
"scadenza</span><br/>"
msgid "<span class=\"title\">Acceptance point</span>"
msgstr "<span class=\"title\">Punto di accettazione</span>"
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid ""
"<br/>\n"
"\n"
" <span class=\"swissqr_text title\">Payable by</"
"span><br/>"
msgstr ""
"<br/>\n"
"\n"
" <span class=\"swissqr_text title\">Pagabile da</"
"span><br/>"
msgid "<span class=\"title\">Account / Payable to</span><br/>"
msgstr "<span class=\"title\">Conto / Pagabile a</span><br/>"
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid ""
"<br/>\n"
"\n"
" <span class=\"swissqr_text title\">Reference</"
"span><br/>"
msgstr ""
"<br/>\n"
"\n"
" <span class=\"swissqr_text title\">Riferimento</"
"span><br/>"
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.res_config_settings_view_form
msgid "<span class=\"o_form_label\">ISR scan line offset</span>"
msgstr ""
"<span class=\"o_form_label\">Offset della linea di scansione SRI</span>"
msgid "<span class=\"title\">Additional information</span><br/>"
msgstr "<span class=\"title\">Informationi supplementari</span><br/>"
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid ""
"<span class=\"swissqr_text title title_zone\">QR-bill Payment Part</span><br/"
">"
msgstr ""
"<span class=\"swissqr_text title title_zone\">Parte di pagamento QR-fattura</"
"span><br/>"
msgid "<span class=\"title\">Amount</span><br/>"
msgstr "<span class=\"title\">Importo</span><br/>"
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid ""
"<span class=\"swissqr_text title title_zone\">QR-bill Payment Receipt Part</"
"span><br/>\n"
"\n"
" <span class=\"swissqr_text title\">Payable to</"
"span><br/>"
msgstr ""
"<span class=\"swissqr_text title title_zone\">QR-fattura Parte Ricevuta di "
"pagamento</span><br/>\n"
"\n"
" <span class=\"swissqr_text title\">Pagabile a</"
"span><br/>"
msgid "<span class=\"title\">Currency</span><br/>"
msgstr "<span class=\"title\">Valuta</span><br/>"
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span class=\"swissqr_text title\">Acceptance point</span>"
msgstr "<span class=\"swissqr_text title\">Punto di accettazione</span>"
msgid "<span class=\"title\">Payable by</span><br/>"
msgstr "<span class=\"title\">Pagabile da</span><br/>"
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span class=\"swissqr_text title\">Additional information</span><br/>"
msgstr "<span class=\"swissqr_text title\">Ulteriori informazioni</span><br/>"
msgid "<span class=\"title\">Reference</span><br/>"
msgstr "<span class=\"title\">Riferimento</span><br/>"
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span class=\"swissqr_text title\">Amount</span><br/>"
msgstr "<span class=\"swissqr_text title\">Importo</span><br/>"
msgid "<span>Payment Part</span>"
msgstr "<span>Sezione pagamento</span>"
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span class=\"swissqr_text title\">Currency</span><br/>"
msgstr "<span class=\"swissqr_text title\">Valuta</span><br/>"
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span class=\"swissqr_text title\">Payable by</span><br/>"
msgstr "<span class=\"swissqr_text title\">Pagabile da</span><br/>"
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span class=\"swissqr_text title\">Payable to</span><br/>"
msgstr "<span class=\"swissqr_text title\">Pagabile a</span><br/>"
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid ""
"<span class=\"swissqr_text title\">Supports</span><br/>\n"
" <span class=\"swissqr_text content\">Credit "
"transfer</span>"
msgstr ""
"<span class=\"swissqr_text title\">Supporta</span><br/>\n"
" <span class=\"swissqr_text content\">Bonifico "
"bancario</span>"
msgid "<span>Receipt</span>"
msgstr "<span>Ricevuta</span>"
#. module: l10n_ch
#: model:account.tax.report.line,name:l10n_ch.account_tax_report_line_chtax_autres_mouv
@@ -1431,6 +1366,11 @@ msgstr "QR-fattura"
msgid "QR-bill for invoice"
msgstr "QR per fattura"
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "QR-bill for invoice"
msgstr "QR-facture"
#. module: l10n_ch
#: model:account.account.template,name:l10n_ch.ch_coa_3801
msgid "Rabais et réduction de prix"
+15 -41
View File
@@ -7,7 +7,7 @@ msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-28 09:52+0000\n"
"PO-Revision-Date: 2020-05-28 09:52+0000\n"
"PO-Revision-Date: 2020-06-17 10:00+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@@ -324,30 +324,6 @@ msgstr ""
msgid "910 Les dons, les dividendes, les dédommagements, ..."
msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid ""
"<br/>\n"
"\n"
" <span class=\"swissqr_text title\">Due date</span><br/>"
msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid ""
"<br/>\n"
"\n"
" <span class=\"swissqr_text title\">Payable by</span><br/>"
msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid ""
"<br/>\n"
"\n"
" <span class=\"swissqr_text title\">Reference</span><br/>"
msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.res_config_settings_view_form
msgid "<span class=\"o_form_label\">ISR scan line offset</span>"
@@ -355,54 +331,52 @@ msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid ""
"<span class=\"swissqr_text title title_zone\">QR-bill Payment "
"Part</span><br/>"
msgid "<span class=\"title\">Acceptance point</span>"
msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid ""
"<span class=\"swissqr_text title title_zone\">QR-bill Payment Receipt Part</span><br/>\n"
"\n"
" <span class=\"swissqr_text title\">Payable to</span><br/>"
msgid "<span class=\"title\">Additional information</span><br/>"
msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span class=\"swissqr_text title\">Acceptance point</span>"
msgid "<span class=\"title\">Amount</span><br/>"
msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span class=\"swissqr_text title\">Additional information</span><br/>"
msgid "<span class=\"title\">Account / Payable to</span><br/>"
msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span class=\"swissqr_text title\">Amount</span><br/>"
msgid "<span class=\"title\">Currency</span><br/>"
msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span class=\"swissqr_text title\">Currency</span><br/>"
msgid "<span class=\"title\">Payable by</span><br/>"
msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span class=\"swissqr_text title\">Payable by</span><br/>"
msgid "<span class=\"title\">Payable to</span><br/>"
msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span class=\"swissqr_text title\">Payable to</span><br/>"
msgid "<span class=\"title\">Reference</span><br/>"
msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid ""
"<span class=\"swissqr_text title\">Supports</span><br/>\n"
" <span class=\"swissqr_text content\">Credit transfer</span>"
msgid "<span>Payment Part</span>"
msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span>Receipt</span>"
msgstr ""
#. module: l10n_ch
+6 -4
View File
@@ -60,9 +60,9 @@ class AccountMove(models.Model):
record.l10n_ch_isr_subscription = _format_isr_subscription_scanline(isr_subscription)
record.l10n_ch_isr_subscription_formatted = _format_isr_subscription(isr_subscription)
@api.depends('name', 'partner_bank_id.l10n_ch_postal')
@api.depends('name', 'partner_bank_id.l10n_ch_postal', 'partner_bank_id.acc_number')
def _compute_l10n_ch_isr_number(self):
""" The ISR reference number is 27 characters long. The first 12 of them
""" The QRR or ISR reference number is 27 characters long. The first 12 of them
contain the postal account number of this ISR's issuer, removing the zeros
at the beginning and filling the empty places with zeros on the right if it is
too short. The next 14 characters contain an internal reference identifying
@@ -72,8 +72,10 @@ class AccountMove(models.Model):
of a recursive modulo 10 on its first 26 characters.
"""
for record in self:
if record.name and record.partner_bank_id and record.partner_bank_id.l10n_ch_postal:
invoice_issuer_ref = record.partner_bank_id.l10n_ch_postal.ljust(l10n_ch_ISR_NUMBER_ISSUER_LENGTH, '0')
has_qriban = record.partner_bank_id._is_qr_iban()
isr_subscription = record.partner_bank_id.l10n_ch_postal
if (has_qriban or isr_subscription) and record.name:
invoice_issuer_ref = (isr_subscription or '').ljust(l10n_ch_ISR_NUMBER_ISSUER_LENGTH, '0')
invoice_ref = re.sub('[^\d]', '', record.name)
#We only keep the last digits of the sequence number if it is too long
invoice_ref = invoice_ref[-l10n_ch_ISR_NUMBER_ISSUER_LENGTH:]
+17 -2
View File
@@ -103,7 +103,7 @@ class ResPartnerBank(models.Model):
if qr_method == 'ch_qr':
qr_code_vals = self._l10n_ch_get_qr_vals(amount, currency, debtor_partner, free_communication, structured_communication)
return '/report/barcode/?type=%s&value=%s&width=%s&height=%s&humanreadable=1&mask=ch_cross' % ('QR', werkzeug.urls.url_quote_plus('\n'.join(qr_code_vals)), 256, 256)
return '/report/barcode/?type=%s&value=%s&width=%s&height=%s&quiet=1&mask=ch_cross' % ('QR', werkzeug.urls.url_quote_plus('\n'.join(qr_code_vals)), 256, 256)
return super()._get_qr_code_url(qr_method, amount, currency, debtor_partner, free_communication, structured_communication)
@@ -161,12 +161,27 @@ class ResPartnerBank(models.Model):
'EPD', # Mandatory trailer part
]
def _get_partner_address_lines(self, partner):
""" Returns a tuple of two elements containing the address lines to use
for this partner. Line 1 contains the street and number, line 2 contains
zip and city. Those two lines are limited to 70 characters
"""
streets = [partner.street, partner.street2]
line_1 = ' '.join(filter(None, streets))
line_2 = partner.zip + ' ' + partner.city
return line_1[:70], line_2[:70]
def _is_qr_iban(self):
""" Tells whether or not this bank account has a QR-IBAN account number.
QR-IBANs are specific identifiers used in Switzerland as references in
QR-codes. They are formed like regular IBANs, but are actually something
different.
"""
# for conveniance when invoice.partner_bank_id, could be replaced
# by a computed field
if not self:
return False
self.ensure_one()
iid_start_index = 4
@@ -210,7 +225,7 @@ class ResPartnerBank(models.Model):
return partner.zip and \
partner.city and \
partner.country_id.code and \
(self.partner_id.street or self.partner_id.street2)
(partner.street or partner.street2)
if qr_method == 'ch_qr':
if not _partner_fields_set(self.partner_id):
+99 -72
View File
@@ -20,100 +20,127 @@
</template>
<template id="l10n_ch_swissqr_template">
<t t-set="o" t-value="o.with_context(lang=lang)"/>
<t t-call="web.external_layout">
<!-- add class to body tag -->
<script>document.body.className += " l10n_ch_qr";</script>
<t t-set="formated_amount" t-value="('%.2f' % (o.amount_residual)).split(' ')[0].replace(',',' ')"/>
<t t-set="formated_amount" t-value="'{:,.2f}'.format(o.amount_residual).replace(',','\xa0')"/>
<div class="swissqr_title">
<h1>QR-bill for invoice <t t-esc="invoice.name"/></h1>
<h1>QR-bill for invoice <t t-esc="o.name"/></h1>
</div>
<div class="swissqr_content">
<div class="swissqr_receipt">
<div id="title_zone" class="swissqr_column_left title_zone">
<span class="swissqr_text title title_zone">QR-bill Payment Receipt Part</span><br/>
<div id="receipt_title_zone" class="main_title swissqr_column_left">
<span>Receipt</span>
</div>
<span class="swissqr_text title">Payable to</span><br/>
<span class="swissqr_text content" t-field="o.partner_bank_id.acc_number"/><br/>
<span class="swissqr_text content" t-field="o.company_id.name"/><br/>
<span class="swissqr_text content" t-field="o.company_id.country_id.code"/>
<span class="swissqr_text content" t-field="o.company_id.zip"/>
<span class="swissqr_text content" t-field="o.company_id.city"/><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/>
<span class="swissqr_text content" t-field="o.partner_id.name"/><br/>
<span class="swissqr_text content" t-field="o.partner_id.country_id.code"/>
<span class="swissqr_text content" t-field="o.partner_id.zip"/>
<span class="swissqr_text content" t-field="o.partner_id.city"/><br/>
<div>
<span class="swissqr_text title">Amount</span><br/>
<span class="swissqr_text content" t-esc="formated_amount"/>
<span class="swissqr_text content" t-field="o.currency_id.name"/>
<div id="receipt_indication_zone" class="swissqr_column_left receipt_indication_zone">
<div class="swissqr_text">
<span class="title">Account / Payable to</span><br/>
<span class="content" t-field="o.partner_bank_id.acc_number"/><br/>
<span class="content" t-field="o.company_id.name"/><br/>
<span class="content" t-field="o.company_id.street"/><br/>
<span class="content" t-field="o.company_id.country_id.code"/>
<span class="content" t-field="o.company_id.zip"/>
<span class="content" t-field="o.company_id.city"/><br/>
</div>
<span class="swissqr_text title">Acceptance point</span>
<t t-if="o.partner_bank_id._is_qr_iban()">
<div class="swissqr_text">
<span class="title">Reference</span><br/>
<span class="content" t-esc="o.space_qrr_reference(o.payment_reference)"/><br/>
</div>
</t>
<div class="swissqr_text">
<span class="title">Payable by</span><br/>
<span class="content" t-field="o.partner_id.name"/><br/>
<span class="content" t-field="o.partner_id.street"> </span>
<span class="content" t-field="o.partner_id.street2"/><br/>
<span class="content" t-field="o.partner_id.country_id.code"/>
<span class="content" t-field="o.partner_id.zip"/>
<span class="content" t-field="o.partner_id.city"/><br/>
</div>
</div>
<div id="receipt_amount_zone" class="swissqr_column_left receipt_amount_zone">
<div class="swissqr_text">
<div class="column">
<span class="title">Currency</span><br/>
<span class="content" t-field="o.currency_id.name"/>
</div>
<div class="column">
<span class="title">Amount</span><br/>
<span class="content" t-esc="formated_amount"/>
</div>
</div>
</div>
<div id="receipt_acceptance_point_zone" class="receipt_acceptance_point_zone">
<div class="swissqr_text content">
<span class="title">Acceptance point</span>
</div>
</div>
</div>
<div class="swissqr_body">
<div id="title_zone" class="swissqr_column_left title_zone">
<span class="swissqr_text title title_zone">QR-bill Payment Part</span><br/>
</div>
<div id="procedure_zone" class="swissqr_column_left procedure_zone">
<span class="swissqr_text title">Supports</span><br/>
<span class="swissqr_text content">Credit transfer</span>
<div class="main_title swissqr_column_left">
<span>Payment Part</span>
</div>
<img class="swissqr" t-att-src="qr_code_urls[o.id]"/>
<div id="indications_zone" class="swissqr_column_right indication_zone">
<span class="swissqr_text title">Payable to</span><br/>
<span class="swissqr_text content" t-field="o.partner_bank_id.acc_number"/><br/>
<span class="swissqr_text content" t-field="o.company_id.name"/><br/>
<span class="swissqr_text content" t-field="o.company_id.street"/><br/>
<span class="swissqr_text content" t-field="o.company_id.country_id.code"/>
<span class="swissqr_text content" t-field="o.company_id.zip"/>
<span class="swissqr_text content" t-field="o.company_id.city"/><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-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/>
<span class="swissqr_text content" t-field="o.partner_id.street"> </span>
<span class="swissqr_text content" t-field="o.partner_id.street2"/><br/>
<span class="swissqr_text content" t-field="o.partner_id.country_id.code"/>
<span class="swissqr_text content" t-field="o.partner_id.zip"/>
<span class="swissqr_text content" t-field="o.partner_id.city"/><br/>
<span class="swissqr_text title">Due date</span><br/>
<span class="swissqr_text content" t-field="o.invoice_date_due"/><br/>
<div id="amount_zone" class="swissqr_column_left amount_zone">
<span class="swissqr_text title">Currency</span><br/>
<span class="swissqr_text content" t-field="o.currency_id.name"/>
<div class="swissqr_text">
<span class="title">Account / Payable to</span><br/>
<span class="content" t-field="o.partner_bank_id.acc_number"/><br/>
<span class="content" t-field="o.company_id.name"/><br/>
<span class="content" t-field="o.company_id.street"/><br/>
<span class="content" t-field="o.company_id.country_id.code"/>
<span class="content" t-field="o.company_id.zip"/>
<span class="content" t-field="o.company_id.city"/><br/>
</div>
<div class="amount_zone amount">
<span class="swissqr_text title">Amount</span><br/>
<span class="swissqr_text content" t-esc="formated_amount"/>
<t t-if="o.partner_bank_id._is_qr_iban()">
<div class="swissqr_text">
<span class="title">Reference</span><br/>
<span class="content" t-esc="o.space_qrr_reference(o.payment_reference)"/><br/>
</div>
</t>
<t t-set="additional_info" t-value="(o.ref or o.name if o.partner_bank_id._is_qr_iban() else o.payment_reference or o.ref or o.name)"/>
<t t-if="additional_info">
<div class="swissqr_text">
<span class="title">Additional information</span><br/>
<span class="content" t-esc="additional_info"/>
</div>
</t>
<div class="swissqr_text">
<span class="title">Payable by</span><br/>
<span class="content" t-field="o.partner_id.name"/><br/>
<span class="content" t-field="o.partner_id.street"> </span>
<span class="content" t-field="o.partner_id.street2"/><br/>
<span class="content" t-field="o.partner_id.country_id.code"/>
<span class="content" t-field="o.partner_id.zip"/>
<span class="content" t-field="o.partner_id.city"/><br/>
</div>
</div>
<div id="amount_zone" class="swissqr_column_left amount_zone">
<div class="swissqr_text">
<div class="column">
<span class="title">Currency</span><br/>
<span class="content" t-field="o.currency_id.name"/>
</div>
<div class="column">
<span class="title">Amount</span><br/>
<span class="content" t-esc="formated_amount"/>
</div>
</div>
</div>
</div>
@@ -124,9 +151,9 @@
<template id="l10n_ch.qr_report_main">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="invoice">
<t t-set="o" t-value="invoice"/>
<t t-call="l10n_ch.l10n_ch_swissqr_template"/>
<t t-foreach="docs" t-as="o">
<t t-set="lang" t-value="o.partner_id.lang"/>
<t t-call="l10n_ch.l10n_ch_swissqr_template" t-lang="lang"/>
</t>
</t>
</template>
@@ -19,13 +19,13 @@ body.l10n_ch_qr {
.swissqr_receipt {
position: absolute;
background_color: white;
background-color: white;
border-color:black;
border-width: 1pt 1pt 1pt 1pt;
border-style: solid;
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 */
width: 77.5mm; /* 62 * 1.25 */
top: 240mm; /* 192 * 1.25 */
left: 0mm;
/*These measures are multiplied by 1.25 here to fit the canvas size used by our reporting engine (1.25 times bigger than A4)*/
}
@@ -37,56 +37,63 @@ body.l10n_ch_qr {
border-width: 1pt 1pt 1pt 1pt;
border-style: solid;
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 */
width: 185mm; /* 148 * 1.25 */
top: 240mm; /* 192 * 1.25 */
left: 77.5mm; /* 62 * 1.25 */
/*These measures are multiplied by 1.25 here to fit the canvas size used by our reporting engine (1.25 times bigger than A4)*/
}
.swissqr {
position: absolute;
height: 70mm;
width: 70mm;
top: 29.5mm;
left: 7mm;
height: 57.5mm; /* 46 * 1.25 */
width: 57.5mm; /* 46 * 1.25 */
top: 20mm; /* 16 * 1.25 */
left: 6.25mm; /* 5 * 1.25 min readability margin for QR */
/*These measures are multiplied by 1.25 here to fit the canvas size used by our reporting engine (1.25 times bigger than A4)*/
}
.ch_cross {
position: absolute;
background-color: white;
height: 8.5mm;
width: 8.5mm;
top: 60.25mm;
left: 37.75mm;
height: 8.75mm; /* 7 * 1.25 */
width: 8.75mm; /* 7 * 1.25 */
top: 44.375mm; /* (16 + 23 - 7/2) * 1.25 = 41.5 * 1.25 */
left: 30.625mm; /* (5 + 23 - 7/2) * 1.25 = 24.5 * 1.25 */
/*These measures are multiplied by 1.25 here to fit the canvas size used by our reporting engine (1.25 times bigger than A4)*/
}
.swissqr_text {
font-family: OCR-B, Arial, Frutiger, Helvetica;
font-family: Arial, Frutiger, Helvetica;
color: black;
line-height: 1;
padding-top: 1em;
.title {
font-size: 8pt;
font-weight: bold;
margin-top: 2mm;
}
.content {
font-size: 10pt;
}
}
.swissqr_text.title {
font-size: 9pt;
font-weight: bold;
}
.swissqr_text.title.title_zone {
.main_title {
margin-top: 5mm;
font-size: 11pt;
font-weight: bold;
}
.swissqr_text.content {
font-size: 11pt;
}
.swissqr_column_left {
position: absolute;
left: 12mm;
left: 5mm;
}
.swissqr_column_right {
position: absolute;
left: 83mm;
left: 70mm; /* (5 + 46 + 5) * 1.25 */
max-width: 90mm;
}
@@ -94,23 +101,45 @@ body.l10n_ch_qr {
top: 15mm;
}
.title_zone {
top: 5mm;
.receipt_indication_zone {
top: 10mm;
}
.indication_zone {
top: 10mm;
}
.amount_zone {
.receipt_amount_zone {
position: absolute;
top: 106mm;
top: 86mm;
.column {
margin-right: 5mm;
float: left;
}
}
.amount {
position: absolute;
left: 41mm;
.receipt_acceptance_point_zone {
position: relative;
top: 100mm;
.content {
float: right;
padding-right: 1em;
}
}
.amount_zone {
position: absolute;
top: 86mm;
.column {
margin-right: 5mm;
float: left;
}
}
}
+1
View File
@@ -3,3 +3,4 @@
from . import test_ch_qr_code
from . import test_l10n_ch_isr
from . import test_swissqr
+177
View File
@@ -0,0 +1,177 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import time
from odoo.addons.account.tests.account_test_classes import AccountingTestCase
from odoo.exceptions import ValidationError
from odoo.tests import tagged
CH_IBAN = 'CH15 3881 5158 3845 3843 7'
QR_IBAN = 'CH21 3080 8001 2345 6782 7'
@tagged('post_install', '-at_install')
class TestSwissQR(AccountingTestCase):
def setUp(self):
super(TestSwissQR, self).setUp()
# Activate SwissQR in Swiss invoices
self.env['ir.config_parameter'].create(
{'key': 'l10n_ch.print_qrcode', 'value': '1'}
)
self.customer = self.env['res.partner'].create(
{
"name": "Partner",
"street": "Route de Berne 41",
"street2": "",
"zip": "1000",
"city": "Lausanne",
"country_id": self.env.ref("base.ch").id,
}
)
self.env.user.company_id.partner_id.write(
{
"street": "Route de Berne 88",
"street2": "",
"zip": "2000",
"city": "Neuchâtel",
"country_id": self.env.ref('base.ch').id,
}
)
self.invoice1 = self.create_invoice('base.CHF')
sale_journal = self.env['account.journal'].search([("type", "=", "sale")])
sale_journal.invoice_reference_model = "ch"
def create_invoice(self, currency_to_use='base.CHF'):
""" Generates a test invoice """
product = self.env.ref("product.product_product_4")
acc_type = self.env.ref('account.data_account_type_current_assets')
account = self.env['account.account'].search(
[('user_type_id', '=', acc_type.id)], limit=1
)
invoice = (
self.env['account.move']
.with_context(default_type='out_invoice')
.create(
{
'type': 'out_invoice',
'partner_id': self.customer.id,
'currency_id': self.env.ref(currency_to_use).id,
'date': time.strftime('%Y') + '-12-22',
'invoice_line_ids': [
(
0,
0,
{
'name': product.name,
'product_id': product.id,
'account_id': account.id,
'quantity': 1,
'price_unit': 42.0,
},
)
],
}
)
)
return invoice
def create_account(self, number):
""" Generates a test res.partner.bank. """
return self.env['res.partner.bank'].create(
{
'acc_number': number,
'partner_id': self.env.user.company_id.partner_id.id,
}
)
def swissqr_not_generated(self, invoice):
""" Prints the given invoice and tests that no Swiss QR generation is triggered. """
self.assertFalse(
invoice.can_generate_qr_bill(),
'No Swiss QR should be generated for this invoice',
)
def swissqr_generated(self, invoice, ref_type='NON'):
""" Prints the given invoice and tests that a Swiss QR generation is triggered. """
self.assertTrue(
invoice.can_generate_qr_bill(), 'A Swiss QR can be generated'
)
if ref_type == 'QRR':
self.assertTrue(invoice.invoice_payment_ref)
struct_ref = invoice.invoice_payment_ref
unstr_msg = invoice.ref or invoice.name or ''
else:
struct_ref = ''
unstr_msg = invoice.invoice_payment_ref or invoice.ref or invoice.name or ''
unstr_msg = (unstr_msg or invoice.number).replace('/', '%2F')
payload = (
"SPC%0A"
"0200%0A"
"1%0A"
"{iban}%0A"
"K%0A"
"YourCompany%0A"
"Route+de+Berne+88%0A"
"2000+Neuch%C3%A2tel%0A"
"%0A%0A"
"CH%0A"
"%0A%0A%0A%0A%0A%0A%0A"
"42.00%0A"
"CHF%0A"
"K%0A"
"Partner%0A"
"Route+de+Berne+41%0A"
"1000+Lausanne%0A"
"%0A%0A"
"CH%0A"
"{ref_type}%0A"
"{struct_ref}%0A"
"{unstr_msg}%0A"
"EPD"
).format(
iban=invoice.partner_bank_id.sanitized_acc_number,
ref_type=ref_type,
struct_ref=struct_ref or '',
unstr_msg=unstr_msg,
)
expected_url = ("/report/barcode/?type=QR&value={}"
"&width=256&height=256&quiet=1").format(payload)
url = invoice.partner_bank_id.build_swiss_code_url(
invoice.amount_residual,
invoice.currency_id.name,
None,
invoice.partner_id,
None,
invoice.invoice_payment_ref,
invoice.ref or invoice.name,
)
self.assertEqual(url, expected_url)
def test_swissQR_missing_bank(self):
# Let us test the generation of a SwissQR for an invoice, first by showing an
# QR is included in the invoice is only generated when Odoo has all the data it needs.
self.invoice1.post()
self.swissqr_not_generated(self.invoice1)
def test_swissQR_iban(self):
# Now we add an account for payment to our invoice
# Here we don't use a structured reference
iban_account = self.create_account(CH_IBAN)
self.invoice1.partner_bank_id = iban_account
self.invoice1.post()
self.swissqr_generated(self.invoice1, ref_type="NON")
def test_swissQR_qriban(self):
# Now use a proper QR-IBAN, we are good to print a QR Bill
qriban_account = self.create_account(QR_IBAN)
self.assertTrue(qriban_account.acc_type, 'qr-iban')
self.invoice1.partner_bank_id = qriban_account
self.invoice1.post()
self.swissqr_generated(self.invoice1, ref_type="QRR")
+7 -1
View File
@@ -499,9 +499,15 @@ class IrActionsReport(models.Model):
value = '0%s' % value
try:
width, height, humanreadable, quiet = int(width), int(height), bool(int(humanreadable)), bool(int(quiet))
# for `QR` type, `quiet` is not supported. And is simply ignored.
# But we can use `barBorder` to get a similar behaviour.
bar_border = 4
if barcode_type == 'QR' and quiet:
bar_border = 0
barcode = createBarcodeDrawing(
barcode_type, value=value, format='png', width=width, height=height,
humanReadable=humanreadable, quiet=quiet
humanReadable=humanreadable, quiet=quiet, barBorder=bar_border
)
# If a mask is asked and it is available, call its function to