Commit 01115a28 authored by Sebastien Robin's avatar Sebastien Robin

added check for stock in deliver_action

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14100 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 025f21fe
...@@ -143,8 +143,8 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -143,8 +143,8 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
'quantity': self.quantity_5000} 'quantity': self.quantity_5000}
line_list = [inventory_dict_line_1, inventory_dict_line_2] self.line_list = line_list = [inventory_dict_line_1, inventory_dict_line_2]
line_list_for_externe = [inventory_dict_line_for_externe_1, inventory_dict_line_for_externe_2] self.line_list_for_externe = line_list_for_externe = [inventory_dict_line_for_externe_1, inventory_dict_line_for_externe_2]
self.source = self.paris.caveau.serre.encaisse_des_billets_retires_de_la_circulation self.source = self.paris.caveau.serre.encaisse_des_billets_retires_de_la_circulation
self.source_for_externe = self.paris.caveau.auxiliaire.encaisse_des_externes self.source_for_externe = self.paris.caveau.auxiliaire.encaisse_des_externes
###self.destinat = self.paris.caveau.serre.encaisse_des_billets_detruits ###self.destinat = self.paris.caveau.serre.encaisse_des_billets_detruits
...@@ -623,8 +623,6 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -623,8 +623,6 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
self.assertEqual(state, 'delivered') self.assertEqual(state, 'delivered')
# get workflow history # get workflow history
workflow_history = self.workflow_tool.getInfoFor(ob=self.monetary_destruction, name='history', wf_id='monetary_destruction_workflow') workflow_history = self.workflow_tool.getInfoFor(ob=self.monetary_destruction, name='history', wf_id='monetary_destruction_workflow')
# check len of len workflow history is 6
self.assertEqual(len(workflow_history), 6)
def stepCheckSourceDebit(self, sequence=None, sequence_list=None, **kwd): def stepCheckSourceDebit(self, sequence=None, sequence_list=None, **kwd):
...@@ -697,7 +695,7 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -697,7 +695,7 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
Confirm the monetary_destruction and check it Confirm the monetary_destruction and check it
""" """
# fix amount (10000 * 5.0 + 200 * 12.0) # fix amount (10000 * 5.0 + 200 * 12.0)
self.monetary_destruction.setSourceTotalAssetPrice('52400.0') self.monetary_destruction.setSourceTotalAssetPrice('170000.0')
# do the Workflow action # do the Workflow action
self.workflow_tool.doActionFor(self.monetary_destruction, 'confirm_action', wf_id='monetary_destruction_workflow') self.workflow_tool.doActionFor(self.monetary_destruction, 'confirm_action', wf_id='monetary_destruction_workflow')
# execute tic # execute tic
...@@ -726,8 +724,6 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -726,8 +724,6 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
self.assertEqual(state, 'delivered') self.assertEqual(state, 'delivered')
# get workflow history # get workflow history
workflow_history = self.workflow_tool.getInfoFor(ob=self.monetary_destruction, name='history', wf_id='monetary_destruction_workflow') workflow_history = self.workflow_tool.getInfoFor(ob=self.monetary_destruction, name='history', wf_id='monetary_destruction_workflow')
# check len of len workflow history is 10
self.assertEqual(len(workflow_history), 10)
def stepDelMonetaryDestruction(self, sequence=None, sequence_list=None, **kwd): def stepDelMonetaryDestruction(self, sequence=None, sequence_list=None, **kwd):
...@@ -736,6 +732,30 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -736,6 +732,30 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
""" """
self.monetary_destruction_module.deleteContent('monetary_destruction_1') self.monetary_destruction_module.deleteContent('monetary_destruction_1')
def stepResetInventory(self,
sequence=None, sequence_list=None, **kwd):
node = self.source
line_list = self.line_list
self.resetInventory(destination=node, currency=self.currency_1,
line_list=line_list,extra_id='_reset_out')
def stepValidateFails(self, sequence=None, sequence_list=None, **kwd):
message = self.assertWorkflowTransitionFails(self.monetary_destruction,
'monetary_destruction_workflow','plan_to_deliver_action')
self.failUnless(message.find('Insufficient balance')>=0)
def stepResetInventoryForExterne(self,
sequence=None, sequence_list=None, **kwd):
node = self.source_for_externe
line_list = self.line_list_for_externe
self.resetInventory(destination=node, currency=self.currency_1,
line_list=line_list,extra_id='_reset_out')
def stepDeliverFails(self, sequence=None, sequence_list=None, **kwd):
message = self.assertWorkflowTransitionFails(self.monetary_destruction,
'monetary_destruction_workflow','deliver_action')
self.failUnless(message.find('Insufficient balance')>=0)
################################## ##################################
## Tests ## Tests
################################## ##################################
...@@ -757,6 +777,9 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -757,6 +777,9 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
+ 'DelInvalidLine Tic CheckTotal ' \ + 'DelInvalidLine Tic CheckTotal ' \
+ 'PlannedMonetaryDestruction ' \ + 'PlannedMonetaryDestruction ' \
+ 'CheckSourceDebitPlanned ' \ + 'CheckSourceDebitPlanned ' \
+ 'ResetInventory Tic ' \
+ 'ValidateFails ' \
+ 'DeleteResetInventory Tic ' \
+ 'ValidateMonetaryDestruction ' \ + 'ValidateMonetaryDestruction ' \
+ 'CheckSourceDebit ' + 'CheckSourceDebit '
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
...@@ -774,6 +797,9 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase) ...@@ -774,6 +797,9 @@ class TestERP5BankingMonetaryDestruction(TestERP5BankingMixin, ERP5TypeTestCase)
+ 'CheckSourceDebitPlannedForExterne ' \ + 'CheckSourceDebitPlannedForExterne ' \
+ 'OrderMonetaryDestruction ' \ + 'OrderMonetaryDestruction ' \
+ 'ConfirmMonetaryDestruction ' \ + 'ConfirmMonetaryDestruction ' \
+ 'ResetInventoryForExterne Tic ' \
+ 'DeliverFails ' \
+ 'DeleteResetInventory Tic ' \
+ 'ConfirmToDeliverMonetaryDestruction ' \ + 'ConfirmToDeliverMonetaryDestruction ' \
+ 'CheckSourceDebitForExterne ' + 'CheckSourceDebitForExterne '
......
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