[IMP] l10n_ch,account,website_sale: Add SwissQR Code on invoice and improve the SEPA QR Code usability
Purpose ======= - Add the SwissQR Code on the invoice in aim to replace the actual ISR - Improve the settings of the SEPA QR Code to make it more user friendly Specifications ============== - ln_ch: - Add a SwissQR Code on the invoice to fit the Switzerland QR-Bill Format - Use the "partner_bank_id" field to generate the QR Code - Add function to get the address number out of the field "street" and "street2" - account: - Remove the SEPA QR Code's journal settings from the general setting - Display the "partner_bank_id" field on the invoice "Other info" page - Use the "partner_bank_id" field to generate the QR Code - website_sale: - Add a check box on the payment acquirers to use the SEPA QR Code on the e-commerce - Use the payment acquirer "journal_id" field to generate the SEPA QR Code
This commit is contained in:
@@ -67,8 +67,6 @@ Best Regards,'''))
|
||||
default='invoice_number', help='You can set here the default communication that will appear on customer invoices, once validated, to help the customer to refer to that particular invoice when making the payment.')
|
||||
|
||||
qr_code = fields.Boolean(string='Display SEPA QR code')
|
||||
qr_code_payment_journal_id = fields.Many2one('account.journal', string='SEPA QR Code Bank Journal account')
|
||||
qr_code_valid = fields.Boolean(string='Has all required arguments', related="qr_code_payment_journal_id.bank_account_id.qr_code_valid")
|
||||
|
||||
invoice_is_email = fields.Boolean('Email by default', default=True)
|
||||
invoice_is_print = fields.Boolean('Print by default', default=True)
|
||||
|
||||
@@ -87,8 +87,6 @@ class ResConfigSettings(models.TransientModel):
|
||||
don't want to reconcile all the past payments with bank statements.""")
|
||||
|
||||
qr_code = fields.Boolean(string='Display SEPA QR code', related='company_id.qr_code')
|
||||
qr_code_payment_journal_id = fields.Many2one('account.journal', related='company_id.qr_code_payment_journal_id', string="Payment Journal", domain="['&',('type', '=', 'bank'), ('currency_id.name','=','EUR')]")
|
||||
qr_code_valid = fields.Boolean(string='Has all required arguments', related="qr_code_payment_journal_id.bank_account_id.qr_code_valid")
|
||||
invoice_is_print = fields.Boolean(string='Print', related='company_id.invoice_is_print')
|
||||
invoice_is_email = fields.Boolean(string='Send Email', related='company_id.invoice_is_email')
|
||||
|
||||
|
||||
@@ -579,7 +579,6 @@
|
||||
<field domain="[('company_id', '=', company_id),('internal_type','=', 'receivable'), ('deprecated', '=', False)]"
|
||||
name="account_id" groups="account.group_account_user"/>
|
||||
<field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/>
|
||||
<field domain="[('partner_id.ref_company_ids', 'in', [company_id])]" name="partner_bank_id" invisible="1"/>
|
||||
<field name="reference" attrs="{'readonly':[('state','!=','draft')]}"/>
|
||||
<field name="name"/>
|
||||
</group>
|
||||
@@ -588,6 +587,7 @@
|
||||
<field name="fiscal_position_id" options="{'no_create': True}" />
|
||||
<field name="move_id" groups="account.group_account_user" attrs="{'invisible': [('move_id', '=', False)]}"/>
|
||||
<field name="origin" groups="base.group_user" attrs="{'invisible': [('origin', '=', False)]}"/>
|
||||
<field name="partner_bank_id" domain="[('partner_id.ref_company_ids', 'in', [company_id])]" context="{'default_partner_id':company_id}"/>
|
||||
</group>
|
||||
</group>
|
||||
<field name="tax_line_ids">
|
||||
|
||||
@@ -179,13 +179,15 @@
|
||||
<p t-if="o.fiscal_position_id.note" name="note">
|
||||
<span t-field="o.fiscal_position_id.note"/>
|
||||
</p>
|
||||
<p t-if="(o.currency_id.name == 'EUR') and (o.company_id.qr_code) and (o.company_id.qr_code_payment_journal_id.bank_account_id.qr_code_valid)">
|
||||
<strong class="text-center">Scan me with your banking app.</strong><br /><br />
|
||||
<img class="border border-dark rounded" t-att-src="o.company_id.qr_code_payment_journal_id.bank_account_id.build_qr_code_url(o.residual,(o.reference) if (o.reference) else o.number)"/>
|
||||
</p>
|
||||
<p t-if="(o.currency_id.name == 'EUR') and (o.company_id.qr_code) and (o.company_id.qr_code_payment_journal_id.bank_account_id.qr_code_valid == False)">
|
||||
<strong class="text-center">The SEPA QR Code informations are not set correctly.</strong><br />
|
||||
</p>
|
||||
<div id="qrcode" t-if="(o.partner_id.country_id.code in ['BE', 'AT', 'DE', 'FI', 'NL']) and (o.company_id.qr_code) and (o.currency_id.name == 'EUR') and (o.partner_bank_id.acc_number != False)">
|
||||
<p t-if="(o.partner_bank_id.qr_code_valid)">
|
||||
<strong class="text-center">Scan me with your banking app.</strong><br /><br />
|
||||
<img class="border border-dark rounded" t-att-src="o.partner_bank_id.build_qr_code_url(o.residual,(o.reference) if (o.reference) else o.number)"/>
|
||||
</p>
|
||||
<p t-if="(o.partner_bank_id.qr_code_valid == False)">
|
||||
<strong class="text-center">The SEPA QR Code informations are not set correctly.</strong><br />
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
</template>
|
||||
|
||||
@@ -280,19 +280,6 @@
|
||||
<div class="text-muted">
|
||||
Add a payment QR code to your invoices
|
||||
</div>
|
||||
<div class="content-group" attrs="{'invisible': [('qr_code', '=', False)]}">
|
||||
<div class="row">
|
||||
<label for="qr_code_payment_journal_id" class="col-md-3 o_light_label"/>
|
||||
<field name="qr_code_payment_journal_id" class="oe_inline"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="badge-danger" attrs="{'invisible': ['|',('qr_code_payment_journal_id', '!=', False), ('qr_code', '=', False)]}">
|
||||
A bank journal must be set to use the SEPA QR code
|
||||
</div>
|
||||
<field name="qr_code_valid" invisible='1'/>
|
||||
<div class="badge-danger" attrs="{'invisible': ['|','|',('qr_code_payment_journal_id', '=', False), ('qr_code', '=', False), ('qr_code_valid','!=',False)]}">
|
||||
Please check that following information are set on the journal: bank account, BIC, EUR as currency.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -38,6 +38,7 @@ Here is how it works:
|
||||
'data/account_fiscal_position_data.xml',
|
||||
'data/account_chart_template_data.xml',
|
||||
'report/isr_report.xml',
|
||||
'report/swissqr_report.xml',
|
||||
'views/res_bank_view.xml',
|
||||
'views/account_invoice_view.xml',
|
||||
'views/res_config_settings_views.xml',
|
||||
|
||||
@@ -6,6 +6,7 @@ import re
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.tools.misc import mod10r
|
||||
|
||||
import werkzeug.urls
|
||||
|
||||
def _is_l10n_ch_postal(account_ref):
|
||||
""" Returns True iff the string account_ref is a valid postal account number,
|
||||
@@ -64,3 +65,93 @@ class ResPartnerBank(models.Model):
|
||||
if _is_l10n_ch_postal(iban[-12:]):
|
||||
return iban[-12:]
|
||||
return None
|
||||
|
||||
def find_number(self, s):
|
||||
# this regex match numbers like 1bis 1a
|
||||
lmo = re.findall('([0-9]+[^ ]*)',s)
|
||||
# no number found
|
||||
if len(lmo) == 0:
|
||||
return ''
|
||||
# Only one number or starts with a number return the first one
|
||||
if len(lmo) == 1 or re.match(r'^\s*([0-9]+[^ ]*)',s):
|
||||
return lmo[0]
|
||||
# else return the last one
|
||||
if len(lmo) > 1:
|
||||
return lmo[-1]
|
||||
else:
|
||||
return ''
|
||||
|
||||
@api.model
|
||||
def build_swiss_code_url(self, amount, currency, date_due, debitor, ref_type, reference, comment):
|
||||
communication = ""
|
||||
if comment:
|
||||
communication = (comment[:137] + '...') if len(comment) > 140 else comment
|
||||
|
||||
t_street_comp = '%s %s' % (self.company_id.street if (self.company_id.street != False) else '', self.company_id.street2 if (self.company_id.street2 != False) else '')
|
||||
t_street_deb = '%s %s' % (debitor.street if (debitor.street != False) else '', debitor.street2 if (debitor.street2 != False) else '')
|
||||
number = self.find_number(t_street_comp)
|
||||
number_deb = self.find_number(t_street_deb)
|
||||
if (t_street_comp == ' '):
|
||||
t_street_comp = False
|
||||
if (t_street_deb == ' '):
|
||||
t_street_deb = False
|
||||
|
||||
qr_code_string = 'SPC\n0100\n1\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s' % (
|
||||
self.acc_number,
|
||||
self.company_id.name,
|
||||
t_street_comp,
|
||||
number,
|
||||
self.company_id.zip,
|
||||
self.company_id.city,
|
||||
self.company_id.country_id.code,
|
||||
amount,
|
||||
currency,
|
||||
date_due,
|
||||
debitor.name,
|
||||
t_street_deb,
|
||||
number_deb,
|
||||
debitor.zip,
|
||||
debitor.city,
|
||||
debitor.country_id.code,
|
||||
ref_type,
|
||||
reference,
|
||||
communication)
|
||||
qr_code_url = '/report/barcode/?type=%s&value=%s&width=%s&height=%s&humanreadable=1' % ('QR', werkzeug.url_quote_plus(qr_code_string), 256, 256)
|
||||
return qr_code_url
|
||||
|
||||
@api.model
|
||||
def validate_swiss_code_arguments(self, currency, debitor):
|
||||
|
||||
t_street_comp = '%s %s' % (self.company_id.street if (self.company_id.street != False) else '', self.company_id.street2 if (self.company_id.street2 != False) else '')
|
||||
t_street_deb = '%s %s' % (debitor.street if (debitor.street != False) else '', debitor.street2 if (debitor.street2 != False) else '')
|
||||
number = self.find_number(t_street_comp)
|
||||
number_deb = self.find_number(t_street_deb)
|
||||
if (t_street_comp == ' '):
|
||||
t_street_comp = False
|
||||
if (t_street_deb == ' '):
|
||||
t_street_deb = False
|
||||
|
||||
if(currency.name == 'EUR'):
|
||||
return (self.bank_id.l10n_ch_postal_eur and
|
||||
self.company_id.zip and
|
||||
self.company_id.city and
|
||||
self.company_id.country_id.code and
|
||||
(t_street_comp != False) and
|
||||
(t_street_deb != False) and
|
||||
debitor.zip and
|
||||
debitor.city and
|
||||
debitor.country_id.code and
|
||||
(number != False) and (number_deb != False))
|
||||
elif(currency.name == 'CHF'):
|
||||
return (self.bank_id.l10n_ch_postal_chf and
|
||||
self.company_id.zip and
|
||||
self.company_id.city and
|
||||
self.company_id.country_id.code and
|
||||
(t_street_comp != False) and
|
||||
(t_street_deb != False) and
|
||||
debitor.zip and
|
||||
debitor.city and
|
||||
debitor.country_id.code and
|
||||
(number != False) and (number_deb != False))
|
||||
else:
|
||||
return False
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
<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_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/>
|
||||
</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>
|
||||
|
||||
<img class="swissqr" t-att-src="o.partner_bank_id.build_swiss_code_url(o.residual, o.currency_id.name, o.date_due, o.partner_id, 'QRR',
|
||||
(o.partner_bank_id.bank_id.l10n_ch_postal_eur) if (o.partner_bank_id.currency_id.name == 'EUR') else o.partner_bank_id.bank_id.l10n_ch_postal_chf,
|
||||
(o.reference) if (o.reference) else o.number)"/>
|
||||
<img class="ch_cross" src="/l10n_ch/static/src/img/CH-Cross_7mm.png"/>
|
||||
|
||||
<div id="indications_zone" class="swissqr_column_right indication_zone">
|
||||
<span class="swissqr_text title">Account</span><br/>
|
||||
<span class="swissqr_text content" t-field="o.partner_bank_id.acc_number"/><br/>
|
||||
|
||||
<span class="swissqr_text title">Creditor</span><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/>
|
||||
|
||||
<span class="swissqr_text title">Reference number</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>
|
||||
|
||||
<span class="swissqr_text title">Additional information</span><br/>
|
||||
<span class="swissqr_text content" t-field="o.reference"/><br/>
|
||||
|
||||
<span class="swissqr_text title">Debtor</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.date_due"/><br/>
|
||||
</div>
|
||||
|
||||
<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>
|
||||
|
||||
<div class="amount_zone amount">
|
||||
<span class="swissqr_text title">Amount</span><br/>
|
||||
<t t-set="formated_amount" t-value="('%.2f' % (o.residual)).split(' ')[0].replace(',',' ')"/>
|
||||
<span class="swissqr_text content" t-esc="formated_amount"/>
|
||||
</div>
|
||||
</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/>
|
||||
-Bank > CHF ISR reference<br/>
|
||||
-Bank > EUR ISR reference<br/>
|
||||
-Your company > Street with number<br/>
|
||||
-Your company > City<br/>
|
||||
-Your company > Zip<br/>
|
||||
-Your company > Country<br/>
|
||||
-Debtor > Street with number<br/>
|
||||
-Debtor > City<br/>
|
||||
-Debtor > Zip<br/>
|
||||
-Debtor > Country
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</xpath>
|
||||
</template>
|
||||
</data>
|
||||
</odoo>
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
@@ -0,0 +1,84 @@
|
||||
.swissqr_content {
|
||||
page-break-before: always;
|
||||
}
|
||||
|
||||
.swissqr_body {
|
||||
position: relative;
|
||||
background-color: white;
|
||||
border-color:black;
|
||||
border-width: 1pt 0pt 0pt 1pt;
|
||||
border-style: solid;
|
||||
height: 116mm;
|
||||
width: 190mm;
|
||||
top: 160mm;
|
||||
left: 70mm;
|
||||
}
|
||||
|
||||
.swissqr{
|
||||
position: absolute;
|
||||
height: 70mm;
|
||||
width: 70mm;
|
||||
top: 29.5mm;
|
||||
left: 7mm;
|
||||
}
|
||||
|
||||
.ch_cross{
|
||||
position: absolute;
|
||||
background-color: white;
|
||||
height: 8.5mm;
|
||||
width: 8.5mm;
|
||||
top: 60.25mm;
|
||||
left: 37.75mm;
|
||||
}
|
||||
|
||||
.swissqr_text{
|
||||
font-family: OCR-B, Arial, Frutiger, Helvetica;
|
||||
color: black;
|
||||
}
|
||||
|
||||
.swissqr_text.title{
|
||||
font-size: 9pt;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.swissqr_text.title.title_zone{
|
||||
font-size: 11pt;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.swissqr_text.content{
|
||||
font-size: 11pt;
|
||||
}
|
||||
|
||||
.swissqr_column_left{
|
||||
position: absolute;
|
||||
left: 12mm;
|
||||
}
|
||||
|
||||
.swissqr_column_right{
|
||||
position: absolute;
|
||||
left: 83mm;
|
||||
max-width: 90mm;
|
||||
}
|
||||
|
||||
.procedure_zone{
|
||||
top: 15mm;
|
||||
}
|
||||
|
||||
.title_zone{
|
||||
top: 5mm;
|
||||
}
|
||||
|
||||
.indication_zone{
|
||||
top: 10mm;
|
||||
}
|
||||
|
||||
.amount_zone{
|
||||
position: absolute;
|
||||
top: 106mm;
|
||||
}
|
||||
|
||||
.amount{
|
||||
position: absolute;
|
||||
left: 41mm;
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import test_l10n_ch_isr
|
||||
from . import test_l10n_ch_isr
|
||||
from . import test_l10n_ch_swissqr
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo.tests.common import TransactionCase
|
||||
from odoo.tests import tagged
|
||||
|
||||
@tagged('post_install', '-at_install')
|
||||
class SwissQRTest(TransactionCase):
|
||||
|
||||
def test_abc_1(self):
|
||||
assert self.env['res.partner.bank'].find_number('1 rue du bois communal') == '1'
|
||||
assert self.env['res.partner.bank'].find_number('1bis rue du bois communal') == '1bis'
|
||||
assert self.env['res.partner.bank'].find_number('rue du bois communal 1') == '1'
|
||||
assert self.env['res.partner.bank'].find_number('rue du bois communal 1bis') == '1bis'
|
||||
assert self.env['res.partner.bank'].find_number('1 rue du 9 mars 1962') == '1'
|
||||
assert self.env['res.partner.bank'].find_number('rue du 9 mars 1962 1') == '1'
|
||||
assert self.env['res.partner.bank'].find_number('1bis rue du 9 mars 1962') == '1bis'
|
||||
assert self.env['res.partner.bank'].find_number('rue du 9 mars 1962 1bis') == '1bis'
|
||||
assert self.env['res.partner.bank'].find_number('rue du 9 mars 1962') == '1962'
|
||||
assert self.env['res.partner.bank'].find_number('rue du 9 mars 1962 4 boite 2') == '2'
|
||||
@@ -143,6 +143,7 @@ class PaymentAcquirer(models.Model):
|
||||
fees_dom_var = fields.Float('Variable domestic fees (in percents)')
|
||||
fees_int_fixed = fields.Float('Fixed international fees')
|
||||
fees_int_var = fields.Float('Variable international fees (in percents)')
|
||||
qr_code = fields.Boolean('Use SEPA QR Code')
|
||||
|
||||
# TDE FIXME: remove that brol
|
||||
module_id = fields.Many2one('ir.module.module', string='Corresponding Module')
|
||||
|
||||
@@ -100,12 +100,14 @@
|
||||
<span name="form_amount" class="form-control" t-esc="tx.amount" t-options="{'widget': 'monetary', 'display_currency': tx.currency_id}"/>
|
||||
</div>
|
||||
</div>
|
||||
<div t-if="tx.acquirer_id.company_id.qr_code and tx.acquirer_id.company_id.qr_code_valid and (tx.currency_id.name == 'EUR')">
|
||||
<h3>Or scan me with your banking app.</h3>
|
||||
<img class="border border-dark rounded" t-att-src="tx.acquirer_id.company_id.qr_code_payment_journal_id.bank_account_id.build_qr_code_url(tx.amount,tx.reference)"/>
|
||||
</div>
|
||||
<div t-if="tx.acquirer_id.company_id.qr_code and (tx.acquirer_id.company_id.qr_code_valid == False) and (tx.currency_id.name == 'EUR')">
|
||||
<h3>The SEPA QR Code informations are not set correctly.</h3>
|
||||
<div t-if="(tx.acquirer_id.qr_code == True) and (tx.currency_id.name == 'EUR')">
|
||||
<div t-if="tx.acquirer_id.journal_id.bank_account_id.qr_code_valid">
|
||||
<h3>Or scan me with your banking app.</h3>
|
||||
<img class="border border-dark rounded" t-att-src="tx.acquirer_id.journal_id.bank_account_id.build_qr_code_url(tx.amount,tx.reference)"/>
|
||||
</div>
|
||||
<div t-if="(tx.acquirer_id.journal_id.bank_account_id.qr_code_valid == False)">
|
||||
<h3>The SEPA QR Code informations are not set correctly.</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<a role="button" t-attf-class="btn btn-#{status} float-right" href="/my/home"><i class="fa fa-arrow-circle-right"/> Back to My Account</a>
|
||||
@@ -137,12 +139,14 @@
|
||||
<div t-if="thanks_msg and payment_tx_id.acquirer_id.provider == 'transfer' and reference">
|
||||
<b>Communication: </b><span t-esc='reference'/>
|
||||
</div>
|
||||
<div t-if="payment_tx_id.acquirer_id.company_id.qr_code and payment_tx_id.acquirer_id.company_id.qr_code_valid and (payment_tx_id.currency_id.name == 'EUR')">
|
||||
<h3>Or scan me with your banking app.</h3>
|
||||
<img class="border border-dark rounded" t-att-src="payment_tx_id.acquirer_id.company_id.qr_code_payment_journal_id.bank_account_id.build_qr_code_url(payment_tx_id.amount,payment_tx_id.reference)"/>
|
||||
</div>
|
||||
<div t-if="payment_tx_id.acquirer_id.company_id.qr_code and (payment_tx_id.acquirer_id.company_id.qr_code_valid == False) and (payment_tx_id.currency_id.name == 'EUR')">
|
||||
<h3>The SEPA QR Code informations are not set correctly.</h3>
|
||||
<div t-if="(payment_tx_id.partner_id.country_id.code in ['BE', 'AT', 'DE', 'FI', 'NL']) and (payment_tx_id.acquirer_id.qr_code == True) and (payment_tx_id.currency_id.name == 'EUR')">
|
||||
<div t-if="payment_tx_id.acquirer_id.journal_id.bank_account_id.qr_code_valid">
|
||||
<h3>Or scan me with your banking app.</h3>
|
||||
<img class="border border-dark rounded" t-att-src="payment_tx_id.acquirer_id.journal_id.bank_account_id.build_qr_code_url(payment_tx_id.amount,payment_tx_id.reference)"/>
|
||||
</div>
|
||||
<div t-if="(payment_tx_id.acquirer_id.journal_id.bank_account_id.qr_code_valid == False)">
|
||||
<h3>The SEPA QR Code informations are not set correctly.</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div t-if="payment_tx_id and payment_tx_id.state == 'authorized'" class="alert alert-success alert-dismissable" role="alert">
|
||||
|
||||
@@ -91,6 +91,7 @@
|
||||
<field name="fees_int_fixed" attrs="{'invisible': [('fees_active', '=', False)]}"/>
|
||||
<field name="fees_int_var" attrs="{'invisible': [('fees_active', '=', False)]}"/>
|
||||
<field name="specific_countries"/>
|
||||
<field name="qr_code" attrs="{'invisible': [('provider', '!=', 'transfer')]}"/>
|
||||
<field name="country_ids" widget="many2many_tags" attrs="{'invisible': [('specific_countries', '=', False)]}"/>
|
||||
<label for="view_template_id" groups="base.group_no_one"/>
|
||||
<div groups="base.group_no_one">
|
||||
|
||||
@@ -1616,12 +1616,12 @@
|
||||
<b>Communication: </b><span t-esc='order.reference'/>
|
||||
</div>
|
||||
</div>
|
||||
<div t-if="payment_tx_id.acquirer_id.provider == 'transfer'">
|
||||
<div class="card-body" t-if="payment_tx_id.acquirer_id.company_id.qr_code and payment_tx_id.acquirer_id.company_id.qr_code_valid and (payment_tx_id.currency_id.name == 'EUR')">
|
||||
<div t-if="(payment_tx_id.acquirer_id.qr_code == True) and (payment_tx_id.acquirer_id.provider == 'transfer') and (payment_tx_id.partner_id.country_id.code in ['BE', 'AT', 'DE', 'FI', 'NL']) and (payment_tx_id.currency_id.name == 'EUR')">
|
||||
<div class="card-body" t-if="payment_tx_id.acquirer_id.journal_id.bank_account_id.qr_code_valid">
|
||||
<h3>Or scan me with your banking app.</h3>
|
||||
<img class="border border-dark rounded" t-att-src="payment_tx_id.acquirer_id.company_id.qr_code_payment_journal_id.bank_account_id.build_qr_code_url(order.amount_total,payment_tx_id.reference)"/>
|
||||
<img class="border border-dark rounded" t-att-src="payment_tx_id.acquirer_id.journal_id.bank_account_id.build_qr_code_url(order.amount_total,payment_tx_id.reference)"/>
|
||||
</div>
|
||||
<div class="card-body" t-if="payment_tx_id.acquirer_id.company_id.qr_code and (payment_tx_id.acquirer_id.company_id.qr_code_valid == False) and (payment_tx_id.currency_id.name == 'EUR')">
|
||||
<div class="card-body" t-if="payment_tx_id.acquirer_id.journal_id.bank_account_id.qr_code_valid == False">
|
||||
<h3>The SEPA QR Code informations are not set correctly.</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -129,11 +129,11 @@ class ResPartnerBank(models.Model):
|
||||
|
||||
@api.multi
|
||||
def _validate_qr_code_arguments(self):
|
||||
for bank in self:
|
||||
for bank in self:
|
||||
if bank.currency_id.name == False:
|
||||
currency = bank.company_id.currency_id
|
||||
else:
|
||||
currency = bank.currency_id
|
||||
currency = bank.currency_id
|
||||
bank.qr_code_valid = (bank.bank_bic
|
||||
and bank.company_id.name
|
||||
and bank.acc_number
|
||||
|
||||
Reference in New Issue
Block a user