summaryrefslogtreecommitdiff
path: root/addons/payment
diff options
context:
space:
mode:
authoroco-odoo <oco@odoo.com>2020-02-07 10:10:09 +0000
committeroco-odoo <oco@odoo.com>2020-03-30 11:28:41 +0000
commit0eef278268d1f4cce30c97bfef723f769b1a48e0 (patch)
treeae9df84a16740d8a41b079da599017a3f55f0a2d /addons/payment
parentc1f3596bd32efcbec40e66c29930ccdc29072f92 (diff)
[IMP] base, account, l10n_ch, website_sale, payment, web: make payment QR-code generation more generic
This new modelling makes it easier to add new QR-code formats, and allows using all of them in website_sale and account.payment's form view as well (so, Swiss QR codes are now available there, while they were restricted to only invoices in the past). All barcodes are now generated as reports, from a dedicated route. This was only partly the case before : Swiss QR added a cross on top of the QR-code directly in the template, it wasn't part of the image returned by the route; now it is. [ADD] base_qr_code_sepa: new module decoupling SEPA QR-codes generation from the base module Each new QR-code generation option should thus be done in a dedicated module (or added to a localization) in the future. [IMP] base_qr_code_sepa: update the generated QR codes to version 2 of the specification Version 1 is still supported, so no need to backport this. [IMP] l10n_ch: make Swiss QR-codes compatible with the new version of the specification (the old one is deprecated) This will be backported to 11.0 and 12.0, as these QR-codes will soon replace ISR. [IMP] account: make it possible to mark manual payments as sent with a button on the form view This way, when making them directly with a QR-code (or doing a more classical wire transfer), people can keep track of what they already have asked the bank to do, and what they still have to treat. closes odoo/odoo#44839 Related: odoo/enterprise#8262 Related: odoo/upgrade#992 Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Diffstat (limited to 'addons/payment')
-rw-r--r--addons/payment/models/payment_acquirer.py2
-rw-r--r--addons/payment/views/payment_portal_templates.xml22
2 files changed, 11 insertions, 13 deletions
diff --git a/addons/payment/models/payment_acquirer.py b/addons/payment/models/payment_acquirer.py
index afe2a1fe65b..c8c79d0e51d 100644
--- a/addons/payment/models/payment_acquirer.py
+++ b/addons/payment/models/payment_acquirer.py
@@ -149,7 +149,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')
+ qr_code = fields.Boolean('Enable QR Codes', help="Enable the use of QR-codes for payments made on this provider.")
# TDE FIXME: remove that brol
module_id = fields.Many2one('ir.module.module', string='Corresponding Module')
diff --git a/addons/payment/views/payment_portal_templates.xml b/addons/payment/views/payment_portal_templates.xml
index f21b6fa079b..49697f429a3 100644
--- a/addons/payment/views/payment_portal_templates.xml
+++ b/addons/payment/views/payment_portal_templates.xml
@@ -93,13 +93,12 @@
<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.qr_code == True) and (tx.currency_id.name == 'EUR')">
- <div t-if="tx.acquirer_id.journal_id.bank_account_id.qr_code_valid">
+
+ <div t-if="tx.acquirer_id.qr_code">
+ <t t-set="qr_code" t-value="tx.acquirer_id.journal_id.bank_account_id.build_qr_code_url(tx.amount, payment_tx_id.reference, None, tx.currency_id, tx.partner_id)"/>
+ <div class="card-body" t-if="qr_code">
<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>
+ <img class="border border-dark rounded" t-att-src="qr_code"/>
</div>
</div>
<div>
@@ -130,13 +129,12 @@
<div t-if="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.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">
+
+ <div t-if="payment_tx_id.acquirer_id.qr_code and (payment_tx_id.acquirer_id.provider == 'transfer')">
+ <t t-set="qr_code" t-value="payment_tx_id.acquirer_id.journal_id.bank_account_id.build_qr_code_url(payment_tx_id.amount,payment_tx_id.reference, None, payment_tx_id.currency_id, payment_tx_id.partner_id)"/>
+ <div class="card-body" t-if="qr_code">
<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>
+ <img class="border border-dark rounded" t-att-src="qr_code"/>
</div>
</div>
</div>