Add warning when payment order is not SEPA

The field 'sepa' on account.payment.order is only display for SEPA
payment methods.
If the option "show warning if not SEPA" is enabled on the payment
method, a warning banner is now displayed on payment orders with a SEPA
payment method which are not SEPA.
This commit is contained in:
Alexis de Lattre
2023-09-27 22:30:31 +02:00
committed by trisdoan
parent 592dc797d1
commit ce4d5c8539
4 changed files with 17 additions and 2 deletions

View File

@@ -6,7 +6,7 @@
{
"name": "Account Banking SEPA Credit Transfer",
"summary": "Create SEPA XML files for Credit Transfers",
"version": "16.0.1.0.0",
"version": "16.0.1.0.1",
"license": "AGPL-3",
"author": "Akretion, Tecnativa, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/bank-payment",

View File

@@ -6,5 +6,6 @@
<field name="payment_type">outbound</field>
<field name="bank_account_required" eval="True" />
<field name="pain_version">pain.001.001.03</field>
<field name="warn_not_sepa" eval="True" />
</record>
</odoo>

View File

@@ -0,0 +1,11 @@
# Copyright 2023 Akretion France (http://www.akretion.com/)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openupgradelib import openupgrade
@openupgrade.migrate()
def migrate(env, version):
sct_method = env.ref("account_banking_sepa_credit_transfer.sepa_credit_transfer")
sct_method.write({"warn_not_sepa": True})

View File

@@ -206,7 +206,10 @@ class TestSCT(TransactionCase):
self.assertEqual(agrolait_pay_line1.communication, "F1341")
self.payment_order.draft2open()
self.assertEqual(self.payment_order.state, "open")
self.assertEqual(self.payment_order.sepa, True)
if self.payment_mode.payment_method_id.pain_version:
self.assertTrue(self.payment_order.sepa)
else:
self.assertFalse(self.payment_order.sepa)
self.assertTrue(self.payment_order.payment_ids)
agrolait_bank_line = self.payment_order.payment_ids[0]
self.assertEqual(agrolait_bank_line.currency_id, self.eur_currency)