[FIX] l10n_ch: fix swiss QR Code crap

The specifications of this feature have not been frozen yet and the feature is not expected before mid-2020. Merging it in stable was premature.
There's now an ir.config.parameter to hide the feature until really needed: a field in the accounting settings will be added in a next version to show it, in the meanwhile people can manually add the parameter to use/test the QR code.

Also fixed all 3 typos/grammar errors in the single sentence message displayed when some pieces of information were missing while printing the QR code

Also fixed the place where the Swiss options for the ISR are displayed in the accounting settings (under 'invoices' instead of 'fiscal periods')

Also fixed a 'not-a-multiple-of-4' indentation.

closes odoo/odoo#28035
This commit is contained in:
qdp-odoo
2018-10-23 07:21:02 +00:00
parent dd94d06727
commit 68dafa0620
4 changed files with 19 additions and 12 deletions
+1 -1
View File
@@ -90,7 +90,7 @@ msgstr ""
#. module: l10n_ch
#: model_terms:ir.ui.view,arch_db:l10n_ch.l10n_ch_swissqr_template
msgid "<span>Some of this informations are not set corrrectly to display the Swiss QR Code.<br/>\n"
msgid "<span>Some pieces of this information are not set correctly to display the Swiss QR Code.<br/>\n"
" -Bank &gt; CHF ISR reference<br/>\n"
" -Bank &gt; EUR ISR reference<br/>\n"
" -Your company &gt; Street with number<br/>\n"
+15 -8
View File
@@ -133,15 +133,22 @@ class AccountInvoice(models.Model):
record.l10n_ch_currency_name in ['EUR', 'CHF']
def split_total_amount(self):
""" Splits the total amount of this invoice in two parts, using the dot as
a separator, and taking two precision digits (always displayed).
These two parts are returned as the two elements of a tuple, as strings
to print in the report.
""" Splits the total amount of this invoice in two parts, using the dot as
a separator, and taking two precision digits (always displayed).
These two parts are returned as the two elements of a tuple, as strings
to print in the report.
This function is needed on the model, as it must be called in the report
template, which cannot reference static functions
"""
return float_split_str(self.amount_total, 2)
This function is needed on the model, as it must be called in the report
template, which cannot reference static functions
"""
return float_split_str(self.amount_total, 2)
def display_swiss_qr_code(self):
""" Trigger the print of the Swiss QR code in the invoice report or not
"""
self.ensure_one()
qr_parameter = self.env['ir.config_parameter'].sudo().get_param('l10n_ch.print_qrcode')
return self.partner_id.country_id.code == 'CH' and qr_parameter
def isr_print(self):
""" Triggered by the 'Print ISR' button.
+2 -2
View File
@@ -4,7 +4,7 @@
<template id="l10n_ch_swissqr_template" inherit_id="account.report_invoice_document">
<xpath expr="//div[@id='qrcode']" position="after">
<link type="text/css" rel="stylesheet" href="/l10n_ch/static/src/scss/report_swissqr.css"/>
<div class="swissqr_content" t-if="o.partner_id.country_id.code == 'CH'">
<div class="swissqr_content" t-if="o.display_swiss_qr_code()">
<div class="swissqr_body" t-if="o.partner_bank_id.validate_swiss_code_arguments(o.partner_bank_id.currency_id, o.partner_id) and ((o.currency_id.name == 'EUR') or (o.currency_id.name == 'CHF'))">
<div id="title_zone" class="swissqr_column_left title_zone">
<span class="swissqr_text title title_zone">QR-bill payment part</span><br/>
@@ -67,7 +67,7 @@
</div>
<div class="swissqr_body" t-if="(o.partner_bank_id.validate_swiss_code_arguments(o.partner_bank_id.currency_id, o.partner_id) == False) and ((o.currency_id.name == 'EUR') or (o.currency_id.name == 'CHF'))">
<div class="swissqr_column_left procedure_zone">
<span>Some of this informations are not set corrrectly to display the Swiss QR Code.<br/>
<span>Some pieces of this information are not set correctly to display the Swiss QR Code.<br/>
-Bank > CHF ISR reference<br/>
-Bank > EUR ISR reference<br/>
-Your company > Street with number<br/>
@@ -6,7 +6,7 @@
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="account.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@id='accounting_reports']" position="inside">
<xpath expr="//div[@id='invoicing_settings']" position="inside">
<div class="col-12 col-lg-6 o_setting_box" id="l10n_ch-isr_print_bank">
<div class="o_setting_left_pane">
<field name="l10n_ch_isr_print_bank_location"/>