Commit 5e707f5d authored by Sebastien Robin's avatar Sebastien Robin

check many worklists, also fix problem of vault in cash balance regulation

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16604 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 84109d45
......@@ -1120,3 +1120,23 @@ class TestERP5BankingMixin:
to_delete_id_list = [x for x in inventory_module.objectIds()
if x.find('reset')>=0]
inventory_module.manage_delObjects(ids=to_delete_id_list)
def checkWorklist(self, document):
"""
"""
document.portal_caches.clearAllCache()
portal_type = document.getPortalType()
state = document.getSimulationState()
workflow_id = '%s_workflow' % portal_type.lower().replace(' ', '_')
actions = self.getPortal().portal_actions.listFilteredActionsFor(document)
found = 0
for action in actions['global']:
if action.get('workflow_id', None) == workflow_id:
url = action.get('url', None)
if url is not None:
if url.find(state)>=0 and url.find(portal_type)>=0:
found = 1
if not found:
import pdb; pdb.set_trace()
self.assertEquals(found, 1)
......@@ -136,7 +136,7 @@ class TestERP5BankingCashBalanceRegulation(TestERP5BankingMixin, ERP5TypeTestCas
self.guichet_1 = self.paris.surface.banque_interne.guichet_1.encaisse_des_billets_et_monnaies
self.createCashInventory(source=self.guichet_1, destination=self.guichet_1, currency=self.currency_1, line_list=line_list)
self.guichet_caveau = self.paris.caveau.serre.encaisse_des_billets_retires_de_la_circulation
self.guichet_caveau = self.paris.caveau.auxiliaire.encaisse_des_billets_et_monnaies
self.createCashInventory(source=self.guichet_caveau, destination=self.guichet_caveau, currency=self.currency_1, line_list=line_list)
self.guichet_salletri = self.paris.surface.salle_tri.encaisse_des_billets_et_monnaies
......@@ -278,7 +278,7 @@ class TestERP5BankingCashBalanceRegulation(TestERP5BankingMixin, ERP5TypeTestCas
self.assertEqual(len(self.cash_balance_regulation_module.objectValues()), 1)
self.cash_balance_regulation = getattr(self.cash_balance_regulation_module, 'cash_balance_regulation_1')
self.assertEqual(self.cash_balance_regulation.getPortalType(), 'Cash Balance Regulation')
self.assertEqual(self.cash_balance_regulation.getSource(), 'site/testsite/paris/caveau/serre/encaisse_des_billets_retires_de_la_circulation')
self.assertEqual(self.cash_balance_regulation.getSource(), 'site/testsite/paris/caveau/auxiliaire/encaisse_des_billets_et_monnaies')
self.assertEqual(self.cash_balance_regulation.getDestination(), None)
def stepCreateCashBalanceRegulationSalleTri(self, sequence=None, sequence_list=None, **kwd):
......@@ -696,7 +696,8 @@ class TestERP5BankingCashBalanceRegulation(TestERP5BankingMixin, ERP5TypeTestCas
def stepCheckWorklist(self, **kw):
self.checkWorklist(self.cash_balance_regulation)
def stepDelCashBalanceRegulation(self, sequence=None, sequence_list=None, **kwd):
"""
......@@ -723,8 +724,10 @@ class TestERP5BankingCashBalanceRegulation(TestERP5BankingMixin, ERP5TypeTestCas
+ 'CreateValidOutgoingLine ' \
+ 'Tic CheckTotal ' \
+ 'CheckInitialInventory ' \
+ 'Tic CheckWorklist ' \
+ 'ConfirmCashBalanceRegulation Tic ' \
+ 'CheckConfirmedInventory ' \
+ 'Tic CheckWorklist ' \
+ 'DeliverCashBalanceRegulation Tic ' \
+ 'CheckFinalInventory'
sequence_list.addSequenceString(sequence_string)
......@@ -736,8 +739,10 @@ class TestERP5BankingCashBalanceRegulation(TestERP5BankingMixin, ERP5TypeTestCas
+ 'CreateValidOutgoingLine ' \
+ 'Tic CheckTotal ' \
+ 'CheckInitialInventoryCaveau ' \
+ 'Tic CheckWorklist ' \
+ 'ConfirmCashBalanceRegulation Tic ' \
+ 'CheckConfirmedInventoryCaveau ' \
+ 'Tic CheckWorklist ' \
+ 'DeliverCashBalanceRegulation Tic ' \
+ 'CheckFinalInventoryCaveau'
sequence_list.addSequenceString(sequence_caveau)
......@@ -750,6 +755,7 @@ class TestERP5BankingCashBalanceRegulation(TestERP5BankingMixin, ERP5TypeTestCas
+ 'CheckInitialInventorySalleTri ' \
+ 'ConfirmCashBalanceRegulation Tic ' \
+ 'CheckConfirmedInventorySalleTri ' \
+ 'Tic CheckWorklist ' \
+ 'DeliverCashBalanceRegulation Tic ' \
+ 'CheckFinalInventorySalleTri'
sequence_list.addSequenceString(sequence_salletri)
......@@ -762,6 +768,7 @@ class TestERP5BankingCashBalanceRegulation(TestERP5BankingMixin, ERP5TypeTestCas
+ 'CheckInitialInventorySurface ' \
+ 'ConfirmCashBalanceRegulation Tic ' \
+ 'CheckConfirmedInventorySurface ' \
+ 'Tic CheckWorklist ' \
+ 'DeliverCashBalanceRegulation Tic ' \
+ 'CheckFinalInventorySurface'
sequence_list.addSequenceString(sequence_surface)
......
......@@ -704,6 +704,8 @@ class TestERP5BankingCashClassification(TestERP5BankingMixin, ERP5TypeTestCase):
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.encaisse_aux_externe.getRelativeUrl(), resource = self.billet_100.getRelativeUrl()), 10.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.encaisse_aux_externe.getRelativeUrl(), resource = self.billet_100.getRelativeUrl()), 10.0)
def stepCheckWorklist(self, **kw):
self.checkWorklist(self.cash_sorting)
##################################
## Tests
......@@ -725,7 +727,9 @@ class TestERP5BankingCashClassification(TestERP5BankingMixin, ERP5TypeTestCase):
+ 'CreateValidOutgoingLineForMixed ' \
+ 'Tic CheckTotal ' \
+ 'CheckSource CheckDestination ' \
+ 'Tic CheckWorklist ' \
+ 'ConfirmCashSorting Tic ' \
+ 'Tic CheckWorklist ' \
+ 'CheckSourceDebitPlanned CheckDestinationCreditPlanned ' \
+ 'DeliverCashSorting Tic ' \
+ 'CheckSourceDebit CheckDestinationCredit '
......
......@@ -498,6 +498,9 @@ class TestERP5BankingCashExchange(TestERP5BankingMixin, ERP5TypeTestCase):
'cash_exchange_workflow','deliver_action')
self.failUnless(message.find('Insufficient balance')>=0)
def stepCheckWorklist(self, **kw):
self.checkWorklist(self.cash_exchange)
##################################
## Tests
......@@ -520,6 +523,7 @@ class TestERP5BankingCashExchange(TestERP5BankingMixin, ERP5TypeTestCase):
+ 'ResetInventory Tic ' \
+ 'DeliverFails Tic ' \
+ 'DeleteResetInventory Tic ' \
+ 'Tic CheckWorklist ' \
+ 'DeliverCashExchange Tic ' \
+ 'CheckFinalInventoryGuichet_1 ' \
+ 'CheckFinalInventoryGuichet_2'
......
......@@ -143,10 +143,14 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin, ERP5TypeTestCase):
self.line_list = line_list = [inventory_dict_line_1, inventory_dict_line_2]
self.vault_source = self.paris.caveau.auxiliaire.encaisse_des_externes
self.currency_handover_vault_source = self.paris.caveau.auxiliaire.encaisse_des_devises.usd
self.vault_destination = self.madrid.caveau.reserve.encaisse_des_billets_et_monnaies
self.createCashInventory(source=None, destination=self.vault_source, currency=self.currency_1,
line_list=line_list)
self.createCashInventory(source=None, destination=self.currency_handover_vault_source,
currency=self.currency_1,
line_list=line_list)
# Create an Organisation that will be used for users assignment
self.checkUserFolderType()
self.organisation = self.organisation_module.newContent(id='baobab_org', portal_type='Organisation',
......@@ -195,6 +199,24 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin, ERP5TypeTestCase):
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.vault_destination.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 0.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.vault_destination.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 0.0)
def stepCheckCurrencyHandoverInitialInventory(self, sequence=None, sequence_list=None, **kwd):
"""
Check the initial inventory before any operations
"""
self.simulation_tool = self.getSimulationTool()
# check we have 5 banknotes of 10000 in vault_source
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.currency_handover_vault_source.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 5.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.currency_handover_vault_source.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 5.0)
# check we have 12 coin of 200 in vault_source
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.currency_handover_vault_source.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 12.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.currency_handover_vault_source.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 12.0)
# check we don't have banknotes of 10000
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.vault_destination.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 0.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.vault_destination.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 0.0)
# check we don't have coins of 200
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.vault_destination.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 0.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.vault_destination.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 0.0)
def stepCreateCashMovement(self, sequence=None, sequence_list=None,
none_destination=0, **kwd):
"""
......@@ -258,7 +280,10 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin, ERP5TypeTestCase):
# check the banknote of the cell is banknote of 10000
self.assertEqual(cell.getResourceValue(), self.billet_10000)
# check the source vault is vault_source
self.assertEqual(cell.getSourceValue(), self.vault_source)
if cell.getExplanationValue().isCurrencyHandover():
self.assertEqual(cell.getSourceValue(), self.currency_handover_vault_source)
else:
self.assertEqual(cell.getSourceValue(), self.vault_source)
# check the destination vault is vault_destination
if cell.getId() == 'movement_0_0_0':
# check the quantity of banknote for year 1992 is 2
......@@ -482,6 +507,19 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin, ERP5TypeTestCase):
# check we will have 0 coin of 200 after deliver
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.vault_source.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 0.0)
def stepCheckCurrencyHandoverSourceDebitStarted(self, sequence=None, sequence_list=None, **kwd):
"""
Check that computaion of inventory at vault vault_source is right after start and before stop
"""
# check we have 0 banknotes of 10000 currently
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.currency_handover_vault_source.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 0.0)
# check we will have 0 banknote of 10000 after deliver
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.currency_handover_vault_source.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 0.0)
# check we have 0 coins of 200 currently
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.currency_handover_vault_source.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 0.0)
# check we will have 0 coin of 200 after deliver
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.currency_handover_vault_source.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 0.0)
def stepCheckDestinationCreditStarted(self, sequence=None, sequence_list=None, **kwd):
"""
Check that compution of inventory at vault vault_destination is right after start and before stop
......@@ -516,6 +554,7 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin, ERP5TypeTestCase):
def stepSetCashMovementCurrencyHandover(self, sequence=None, sequence_list=None, **kwd):
self.cash_movement.setCurrencyHandover(True)
self.cash_movement.setDestination(None)
self.cash_movement.setSourceValue(self.currency_handover_vault_source)
def stepDeliverCashMovement(self, sequence=None, sequence_list=None, **kwd):
"""
......@@ -543,7 +582,16 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin, ERP5TypeTestCase):
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.vault_source.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 0.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.vault_source.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 0.0)
def stepCheckCurrencyHandoverSourceDebit(self, sequence=None, sequence_list=None, **kwd):
"""
Check inventory at source (vault vault_source) after deliver of the cash_movement
"""
# check we have 0 banknote of 10000
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.currency_handover_vault_source.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 0.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.currency_handover_vault_source.getRelativeUrl(), resource = self.billet_10000.getRelativeUrl()), 0.0)
# check we have 0 coin of 200
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.currency_handover_vault_source.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 0.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.currency_handover_vault_source.getRelativeUrl(), resource = self.piece_200.getRelativeUrl()), 0.0)
def stepCheckDestinationCredit(self, sequence=None, sequence_list=None, **kwd):
"""
......@@ -588,6 +636,9 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin, ERP5TypeTestCase):
'cash_movement_workflow','start_action')
self.failUnless(message.find('Insufficient balance')>=0)
def stepCheckWorklist(self, **kw):
self.checkWorklist(self.cash_movement)
def test_01_ERP5BankingCashMovement(self, quiet=QUIET, run=RUN_ALL_TEST):
"""
......@@ -602,14 +653,18 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin, ERP5TypeTestCase):
+ 'CreateValidLine2 CheckTotal ' \
+ 'CheckInitialInventory ' \
+ 'CreateInvalidLine ' \
+ 'Tic CheckWorklist ' \
+ 'TryConfirmCashMovementWithBadInventory ' \
+ 'DelInvalidLine Tic CheckTotal ' \
+ 'ConfirmCashMovement ' \
+ 'ResetSourceInventory Tic ' \
+ 'Tic CheckWorklist ' \
+ 'StartCashMovementFails DeleteResetInventory Tic ' \
+ 'StartCashMovement ' \
+ 'Tic CheckWorklist ' \
+ 'CheckSourceDebitStarted CheckDestinationCreditStarted ' \
+ 'StopCashMovement ' \
+ 'Tic CheckWorklist ' \
+ 'DeliverCashMovement ' \
+ 'CheckSourceDebit CheckDestinationCredit '
......@@ -617,19 +672,24 @@ class TestERP5BankingCashMovement(TestERP5BankingMixin, ERP5TypeTestCase):
# Another sequence in order to test that the currency handover
# is working
sequence_string = 'Tic DelCashMovement Tic CheckInitialInventory ' \
sequence_string = 'Tic DelCashMovement Tic CheckCurrencyHandoverInitialInventory ' \
+ 'CreateCashMovement ' \
+ 'SetCashMovementCurrencyHandover ' \
+ 'CreateValidLine1 CheckSubTotal ' \
+ 'CreateValidLine2 CheckTotal ' \
+ 'CheckInitialInventory ' \
+ 'CheckCurrencyHandoverInitialInventory ' \
+ 'Tic CheckTotal ' \
+ 'Tic CheckWorklist ' \
+ 'ConfirmCashMovement ' \
+ 'Tic CheckWorklist ' \
+ 'StartCashMovement ' \
+ 'CheckSourceDebitStarted CheckDestinationHasNotChanged ' \
+ 'CheckCurrencyHandoverSourceDebitStarted ' \
+ 'CheckDestinationHasNotChanged ' \
+ 'Tic CheckWorklist ' \
+ 'StopCashMovement ' \
+ 'Tic CheckWorklist ' \
+ 'DeliverCashMovement ' \
+ 'CheckSourceDebit CheckDestinationHasNotChanged '
+ 'CheckCurrencyHandoverSourceDebit CheckDestinationHasNotChanged '
sequence_list.addSequenceString(sequence_string)
......
......@@ -602,6 +602,8 @@ class TestERP5BankingCashSorting(TestERP5BankingMixin, ERP5TypeTestCase):
'cash_sorting_workflow','deliver_action')
self.failUnless(message.find('Insufficient balance')>=0)
def stepCheckWorklist(self, **kw):
self.checkWorklist(self.cash_sorting)
##################################
## Tests
......@@ -621,9 +623,11 @@ class TestERP5BankingCashSorting(TestERP5BankingMixin, ERP5TypeTestCase):
+ 'CreateValidOutgoingLineForExternalBanknote ' \
+ 'CreateValidOutgoingLineForInternalAndCancelledBanknote Tic CheckTotal ' \
+ 'CheckSource CheckDestination ' \
+ 'Tic CheckWorklist ' \
+ 'ConfirmCashSorting Tic ' \
+ 'CheckSourceDebitPlanned CheckDestinationCreditPlanned ' \
+ 'ResetSourceInventory Tic ' \
+ 'Tic CheckWorklist ' \
+ 'DeliverCashSortingFails Tic ' \
+ 'DeleteResetInventory Tic ' \
+ 'DeliverCashSorting Tic ' \
......
......@@ -444,15 +444,14 @@ class TestERP5BankingCashToCurrencyPurchase(TestERP5BankingMixin, ERP5TypeTestCa
self.assertEqual(self.simulation_tool.getCurrentInventory(node=self.guichet_sortante.getRelativeUrl(), resource = self.piece_100.getRelativeUrl()), 0.0)
self.assertEqual(self.simulation_tool.getFutureInventory(node=self.guichet_sortante.getRelativeUrl(), resource = self.piece_100.getRelativeUrl()), 0.0)
def stepDelCashToCurrencyPurchase(self, sequence=None, sequence_list=None, **kwd):
"""
Delete the invalid vault_transfer line previously create
"""
self.cash_to_currency_purchase_module.deleteContent('cash_to_currency_purchase_1')
def stepCheckWorklist(self, **kw):
self.checkWorklist(self.cash_to_currency_purchase)
##################################
## Tests
......@@ -471,6 +470,7 @@ class TestERP5BankingCashToCurrencyPurchase(TestERP5BankingMixin, ERP5TypeTestCa
+ 'CreateValidIncomingLine CheckSubTotal ' \
+ 'CreateValidOutgoingLine ' \
+ 'Tic CheckTotal ' \
+ 'Tic CheckWorklist ' \
+ 'DeliverCashToCurrencyPurchase Tic ' \
+ 'CheckFinalInventoryGuichet_Entrante ' \
+ 'CheckFinalInventoryGuichet_Sortante'
......
......@@ -411,6 +411,8 @@ class TestERP5BankingCashToCurrencySale(TestERP5BankingMixin, ERP5TypeTestCase):
'cash_to_currency_sale_workflow','deliver_action')
self.failUnless(message.find('Insufficient balance')>=0)
def stepCheckWorklist(self, **kw):
self.checkWorklist(self.cash_to_currency_sale)
##################################
## Tests
......@@ -432,6 +434,7 @@ class TestERP5BankingCashToCurrencySale(TestERP5BankingMixin, ERP5TypeTestCase):
+ 'ResetSourceInventory Tic ' \
+ 'DeliverCashToCurrencySaleFails Tic ' \
+ 'DeleteResetInventory Tic ' \
+ 'CheckWorklist Tic ' \
+ 'DeliverCashToCurrencySale Tic ' \
+ 'CheckFinalInventoryGuichet_Entrante ' \
+ 'CheckFinalInventoryGuichet_Sortante'
......
......@@ -474,6 +474,24 @@ class TestERP5BankingCheckPaymentMixin:
'check_payment_workflow','deliver_action')
self.failUnless(message.find('Insufficient balance')>=0)
def stepCheckCheckIsDelivered(self, sequence=None, sequence_list=None, **kwd):
"""
Make sure that the check is in delivered state
"""
check = self.check_payment.getAggregateValue()
self.assertEquals(check, self.check_1)
self.assertEquals(check.getSimulationState(), 'delivered')
def stepCheckUndeliverCheck(self, sequence=None, sequence_list=None, **kwd):
"""
Make sure that the check is in delivered state
"""
check = self.check_payment.getAggregateValue()
self.assertEquals(check, self.check_1)
self.workflow_tool.doActionFor(check, 'undeliver_action',
wf_id='check_workflow')
self.assertEquals(check.getSimulationState(), 'confirmed')
class TestERP5BankingCheckPayment(TestERP5BankingCheckPaymentMixin,
TestERP5BankingMixin, ERP5TypeTestCase):
......@@ -501,6 +519,8 @@ class TestERP5BankingCheckPayment(TestERP5BankingCheckPaymentMixin,
'PayCheckPaymentFails Tic ' \
'DeleteResetInventory Tic ' \
'Pay Tic ' \
'CheckCheckIsDelivered Tic ' \
'CheckUndeliverCheck Tic ' \
'CheckFinalInventory Cleanup Tic'
# sequence 2 : check if validating with non-exiting check fail if
# automatic check creation is disabled.
......
......@@ -280,6 +280,9 @@ class TestERP5BankingCheckbookDelivery(TestERP5BankingCheckbookDeliveryMixin,
self.failUnless(message.find('Sorry, the item with reference')>=0)
self.failUnless(message.find('is not available any more')>=0)
def stepCheckWorklist(self, **kw):
self.checkWorklist(self.checkbook_delivery)
##################################
## Tests
##################################
......@@ -297,6 +300,7 @@ class TestERP5BankingCheckbookDelivery(TestERP5BankingCheckbookDeliveryMixin,
+ 'ChangePreviousDeliveryDate Tic ' \
+ 'DeliverCheckbookDeliveryFails Tic ' \
+ 'PutBackPreviousDeliveryDate Tic ' \
+ 'CheckWorklist Tic ' \
+ 'DeliverCheckbookDelivery Tic ' \
+ 'CheckFinalCheckbookInventory'
sequence_list.addSequenceString(sequence_string)
......
......@@ -314,6 +314,9 @@ class TestERP5BankingCheckbookMovement(TestERP5BankingCheckbookVaultTransferMixi
self.failUnless(message.find('Sorry, the item with reference')>=0)
self.failUnless(message.find('is not available any more')>=0)
def stepCheckWorklist(self, **kw):
self.checkWorklist(self.checkbook_movement)
##################################
## Tests
##################################
......@@ -328,13 +331,17 @@ class TestERP5BankingCheckbookMovement(TestERP5BankingCheckbookVaultTransferMixi
sequence_string = 'Tic CheckObjects Tic CheckInitialCheckbookInventory ' \
+ 'CreateCheckbookMovement Tic ' \
+ 'CreateCheckAndCheckbookLineList Tic ' \
+ 'CheckWorklist ' \
+ 'PlanCheckbookMovement Tic ' \
+ 'CheckWorklist ' \
+ 'OrderCheckbookMovement Tic ' \
+ 'CheckWorklist ' \
+ 'ConfirmCheckbookMovement Tic ' \
+ 'CheckConfirmedCheckbookInventory Tic ' \
+ 'ChangePreviousDeliveryDate Tic ' \
+ 'DeliverCheckbookMovementFails Tic ' \
+ 'PutBackPreviousDeliveryDate Tic ' \
+ 'CheckWorklist ' \
+ 'DeliverCheckbookMovement Tic ' \
+ 'CheckFinalCheckbookInventory'
sequence_list.addSequenceString(sequence_string)
......
......@@ -140,7 +140,7 @@ class TestERP5BankingCheckbookReception(TestERP5BankingMixin, ERP5TypeTestCase):
def stepCreateCheckbookReception(self, sequence=None, sequence_list=None,
id='checkbook_reception', **kwd):
id='checkbook_reception', imported=0, **kwd):
"""
Create a checkbook reception document and check it
"""
......@@ -150,16 +150,20 @@ class TestERP5BankingCheckbookReception(TestERP5BankingMixin, ERP5TypeTestCase):
source_value=None, destination_value=self.destination_site,
resource_value=self.currency_1,
description='test',
start_date=self.date)
start_date=self.date,
imported=imported)
setattr(self, id, checkbook_reception)
# get the checkbook reception document
self.checkbook_reception = getattr(self.checkbook_reception_module, 'checkbook_reception')
self.checkbook_reception = getattr(self.checkbook_reception_module, id)
# check its portal type
self.assertEqual(self.checkbook_reception.getPortalType(), 'Checkbook Reception')
# check that its source is caisse_1
self.assertEqual(self.checkbook_reception.getSource(), None)
# check that its destination is caisse_2
self.assertEqual(self.checkbook_reception.getBaobabDestination(),
if imported:
self.assertEqual(self.checkbook_reception.getBaobabDestination(), None)
else:
self.assertEqual(self.checkbook_reception.getBaobabDestination(),
'site/testsite/paris/caveau/auxiliaire/encaisse_des_billets_et_monnaies')
return self.checkbook_reception
......@@ -172,6 +176,10 @@ class TestERP5BankingCheckbookReception(TestERP5BankingMixin, ERP5TypeTestCase):
def stepCreateCheckbookReception4(self, sequence=None, sequence_list=None, **kwd):
self.stepCreateCheckbookReception(id='checkbook_reception4')
def stepCreateCheckbookReception5(self, sequence=None, sequence_list=None, **kwd):
self.stepCreateCheckbookReception(id='checkbook_reception5',
imported=1)
def stepCreateCheckAndCheckbookLineList2(self, sequence=None, sequence_list=None, **kwd):
"""
Create the checkbook
......@@ -214,6 +222,22 @@ class TestERP5BankingCheckbookReception(TestERP5BankingMixin, ERP5TypeTestCase):
reference_range_max='0000150',
)
def stepCreateCheckAndCheckbookLineList5(self, sequence=None, sequence_list=None, **kwd):
"""
Create the checkbook
"""
# This is not required to create checkbook items, they will be
# automatically created with the confirm action worfklow transition
# Add a line for check and checkbook
self.line_1 = self.checkbook_reception5.newContent(quantity=1,
resource_value=self.checkbook_model_1,
check_amount_value=self.checkbook_model_1.variant_1,
destination_payment_value=self.bank_account_1,
reference_range_min='0000200',
reference_range_max='0000249',
)
def stepCreateCheckAndCheckbookLineList(self, sequence=None, sequence_list=None, **kwd):
"""
Create the checkbook
......@@ -299,6 +323,14 @@ class TestERP5BankingCheckbookReception(TestERP5BankingMixin, ERP5TypeTestCase):
wf_id='checkbook_reception_workflow')
self.assertEqual(self.checkbook_reception4.getSimulationState(), 'confirmed')
def stepConfirmCheckbookReception5(self, sequence=None, sequence_list=None, **kwd):
"""
confirm the monetary reception
"""
self.workflow_tool.doActionFor(self.checkbook_reception5, 'confirm_action',
wf_id='checkbook_reception_workflow')
self.assertEqual(self.checkbook_reception5.getSimulationState(), 'confirmed')
def stepDeliverCheckbookReception2Fails(self, sequence=None, sequence_list=None, **kwd):
"""
confirm the monetary reception
......@@ -327,6 +359,14 @@ class TestERP5BankingCheckbookReception(TestERP5BankingMixin, ERP5TypeTestCase):
>=0)
self.failUnless(msg.find('150')>=0)
def stepDeliverCheckbookReception5(self, sequence=None, sequence_list=None, **kwd):
"""
confirm the monetary reception
"""
self.workflow_tool.doActionFor(self.checkbook_reception5, 'deliver_action',
wf_id='checkbook_reception_workflow')
self.assertEqual(self.checkbook_reception3.getSimulationState(), 'delivered')
def stepDeliverCheckbookReception(self, sequence=None, sequence_list=None, **kw):
"""
Deliver the monetary reception
......@@ -358,6 +398,18 @@ class TestERP5BankingCheckbookReception(TestERP5BankingMixin, ERP5TypeTestCase):
self.failIfDifferentSet(checkbook_object_list,[self.checkbook_1,self.check_1])
self.assertEqual(len(self.simulation_tool.getFutureTrackingList(node=self.reception.getRelativeUrl())), 2)
def stepCheckConfirmedCheckbookForImport(self, sequence=None, sequence_list=None, **kw):
"""
Check cash checkbook in item table
"""
checkbook = self.checkbook_reception5.objectValues()[0].getAggregateValue()
self.assertEqual(checkbook.getValidationState(), 'confirmed')
check = checkbook.objectValues()[0]
self.assertEqual(check.getSimulationState(), 'confirmed')
def stepCheckWorklist(self, **kw):
self.checkWorklist(self.checkbook_reception)
##################################
## Tests
##################################
......@@ -372,7 +424,9 @@ class TestERP5BankingCheckbookReception(TestERP5BankingMixin, ERP5TypeTestCase):
sequence_string = 'Tic CheckObjects Tic CheckInitialCheckbookInventory ' \
+ 'CreateCheckbookReception Tic ' \
+ 'CreateCheckAndCheckbookLineList Tic ' \
+ 'CheckWorklist Tic ' \
+ 'ConfirmCheckbookReception Tic ' \
+ 'CheckWorklist Tic ' \
+ 'DeliverCheckbookReception Tic ' \
+ 'CheckItemsCreated ' \
+ 'CheckFinalCheckbookInventory'
......@@ -401,6 +455,16 @@ class TestERP5BankingCheckbookReception(TestERP5BankingMixin, ERP5TypeTestCase):
+ 'DeliverCheckbookReception4Fails '
sequence_list.addSequenceString(sequence_string)
# Make sure that if we have an import, then everything
# will be confirmed automatically
sequence_string = 'Tic ' \
+ 'CreateCheckbookReception5 Tic ' \
+ 'CreateCheckAndCheckbookLineList5 Tic ' \
+ 'ConfirmCheckbookReception5 Tic ' \
+ 'DeliverCheckbookReception5 Tic ' \
+ 'CheckConfirmedCheckbookForImport Tic '
sequence_list.addSequenceString(sequence_string)
# play the sequence
sequence_list.play(self)
......
......@@ -373,6 +373,9 @@ class TestERP5BankingCheckbookUsualCashTransfer(TestERP5BankingCheckbookUsualCas
self.failUnless(message.find('Sorry, the item with reference')>=0)
self.failUnless(message.find('is not available any more')>=0)
def stepCheckWorklist(self, **kw):
self.checkWorklist(self.checkbook_usual_cash_transfer)
##################################
## Tests
##################################
......@@ -389,11 +392,13 @@ class TestERP5BankingCheckbookUsualCashTransfer(TestERP5BankingCheckbookUsualCas
+ 'CreateCheckAndCheckbookLineList Tic ' \
+ 'CheckConfirmCheckbookUsualCashTransferRaiseError Tic ' \
+ 'ChangeCheckbookUsualCashTransferStartDate Tic ' \
+ 'CheckWorklist Tic ' \
+ 'ConfirmCheckbookUsualCashTransfer Tic ' \
+ 'CheckConfirmedCheckbookInventory Tic ' \
+ 'ChangePreviousDeliveryDate Tic ' \
+ 'DeliverCheckbookUsualCashTransferFails Tic ' \
+ 'PutBackPreviousDeliveryDate Tic ' \
+ 'CheckWorklist Tic ' \
+ 'DeliverCheckbookUsualCashTransfer Tic ' \
+ 'CheckFinalCheckbookInventory'
sequence_list.addSequenceString(sequence_string)
......
......@@ -370,6 +370,9 @@ class TestERP5BankingCheckbookVaultTransfer(TestERP5BankingCheckbookVaultTransfe
self.failUnless(message.find('Sorry, the item with reference')>=0)
self.failUnless(message.find('is not available any more')>=0)
def stepCheckWorklist(self, **kw):
self.checkWorklist(self.checkbook_vault_transfer)
##################################
## Tests
##################################
......@@ -384,12 +387,15 @@ class TestERP5BankingCheckbookVaultTransfer(TestERP5BankingCheckbookVaultTransfe
sequence_string = 'Tic CheckObjects Tic CheckInitialCheckbookInventory ' \
+ 'CreateCheckbookVaultTransfer Tic ' \
+ 'CreateCheckAndCheckbookLineList Tic ' \
+ 'CheckWorklist Tic ' \
+ 'OrderCheckbookVaultTransfer Tic ' \
+ 'CheckWorklist Tic ' \
+ 'ConfirmCheckbookVaultTransfer Tic ' \
+ 'CheckConfirmedCheckbookInventory Tic ' \
+ 'ChangePreviousDeliveryDate Tic ' \
+ 'DeliverCheckbookVaultTransferFails Tic ' \
+ 'PutBackPreviousDeliveryDate Tic ' \
+ 'CheckWorklist Tic ' \
+ 'DeliverCheckbookVaultTransfer Tic ' \
+ 'CheckFinalCheckbookInventory'
sequence_list.addSequenceString(sequence_string)
......
......@@ -309,16 +309,8 @@ class TestERP5BankingStopPayment( TestERP5BankingCheckbookDeliveryMixin,
"""
self.assertEqual(self.check_1.getSimulationState(),'confirmed')
def stepCheckConfirmedWorklist(self, sequence=None, sequence_list=None, **kw):
"""
"""
actions = self.getPortal().portal_actions.listFilteredActionsFor(self.stop_payment)
found = 0
for action in actions['global']:
if action.get('workflow_id', None) == 'stop_payment_workflow':
if action.get('title', None) == 'Stop Payment To Confirm (1)':
found = 1
self.assertEquals(found, 1)
def stepCheckStopPaymentWorklist(self, **kw):
self.checkWorklist(self.stop_payment)
##################################
## Tests
......@@ -336,12 +328,13 @@ class TestERP5BankingStopPayment( TestERP5BankingCheckbookDeliveryMixin,
+ 'CreateStopPayment Tic ' \
+ 'SetStopPaymentDebit Tic ' \
+ 'ConfirmStopPayment Tic ' \
+ 'CheckConfirmedWorklist Tic ' \
+ 'CheckStopPaymentWorklist Tic ' \
+ 'CheckLineCreated Tic ' \
+ 'CheckConfirmedCheckbookInventory ' \
+ 'StartStopPayment Tic ' \
+ 'CheckCheckIsStopped Tic ' \
+ 'DebitStopStopPayment Tic ' \
+ 'CheckStopPaymentWorklist Tic ' \
+ 'DebitDeliverStopPayment Tic ' \
+ 'CheckCheckIsConfirmed Tic ' \
+ 'CheckInitialAndFinalCheckbookInventory '
......
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