Commit 72b6cb84 authored by Jérome Perrin's avatar Jérome Perrin

payment_mean_sepa: refuse generating file when payments are still being selected

parent 089c8a92
from Products.ERP5Type.Message import translateString
# Same check as in PaymentTransactionGroup_selectPaymentTransactionLineList
tag = 'PaymentTransactionGroup_selectPaymentTransactionList'
context.serialize()
if context.getPortalObject().portal_activities.countMessageWithTag(tag,):
return context.Base_redirect(form_id, keep_items=dict(portal_status_message=translateString(
"Some payments are still beeing processed in the background, please retry later")))
assert version == 'pain.001.001.02', 'Unsupported version'
portal = context.getPortalObject()
......
......@@ -198,7 +198,6 @@ class TestPaymentTransactionGroupPaymentSEPA(AccountingTestCase):
['PT-1', 'PT-2'],
)
def test_generate_sepa_credit_transfer_action(self):
ptg = self._createPTG()
ret = ptg.PaymentTransactionGroup_generateSEPACreditTransferFile(
......@@ -224,6 +223,18 @@ class TestPaymentTransactionGroupPaymentSEPA(AccountingTestCase):
['300.00'],
)
def test_generate_sepa_credit_transfer_refused_when_activities_are_pending(self):
ptg = self._createPTG()
ptg.PaymentTransactionGroup_selectPaymentTransactionLineList(
select_mode='stopped_or_delivered')
self.commit()
ret = ptg.PaymentTransactionGroup_generateSEPACreditTransferFile(
version='pain.001.001.02')
self.assertEqual(
urlparse.parse_qs(urlparse.urlparse(ret).query)['portal_status_message'],
['Some payments are still beeing processed in the background, please retry later'])
self.tic()
class TestSEPAConstraints(AccountingTestCase):
def afterSetUp(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment