Commit 35db1deb authored by Jérome Perrin's avatar Jérome Perrin Committed by Aurel

payment_mean_sepa: refuse generating file when payments are still being selected

parent b50b7ca0
from Products.ERP5Type.Message import translateString 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' assert version == 'pain.001.001.02', 'Unsupported version'
portal = context.getPortalObject() portal = context.getPortalObject()
......
...@@ -198,7 +198,6 @@ class TestPaymentTransactionGroupPaymentSEPA(AccountingTestCase): ...@@ -198,7 +198,6 @@ class TestPaymentTransactionGroupPaymentSEPA(AccountingTestCase):
['PT-1', 'PT-2'], ['PT-1', 'PT-2'],
) )
def test_generate_sepa_credit_transfer_action(self): def test_generate_sepa_credit_transfer_action(self):
ptg = self._createPTG() ptg = self._createPTG()
ret = ptg.PaymentTransactionGroup_generateSEPACreditTransferFile( ret = ptg.PaymentTransactionGroup_generateSEPACreditTransferFile(
...@@ -224,6 +223,18 @@ class TestPaymentTransactionGroupPaymentSEPA(AccountingTestCase): ...@@ -224,6 +223,18 @@ class TestPaymentTransactionGroupPaymentSEPA(AccountingTestCase):
['300.00'], ['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): class TestSEPAConstraints(AccountingTestCase):
def afterSetUp(self): 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