Commit 41e8ad8d authored by Yusei Tahara's avatar Yusei Tahara

Add a test to make sure that cancelling delivered inventory changes existing stock table records.

parent f9ad726b
......@@ -1971,6 +1971,51 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase):
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_05_CancelInventoryAfterDelivered(self, quiet=0, run=run_all_test):
"""
Make sure that changing workflow state after delivered changes
records in stock table.
"""
delivered_state = self.portal.portal_workflow.inventory_workflow.states['delivered']
delivered_state.transitions = delivered_state.transitions + ('cancel',)
self.commit()
organisation = self.portal.organisation_module.newContent(portal_type='Organisation')
product = self.portal.product_module.newContent(portal_type='Product')
inventory = self.portal.inventory_module.newContent(portal_type='Inventory')
inventory.edit(destination_value=organisation,
stop_date=DateTime('2012/09/12 00:00:00 GMT+9'))
line = inventory.newContent(portal_type='Inventory Line')
line.setResourceValue(product)
line.setQuantity(100)
self.tic()
self.assertEqual(
self.portal.portal_simulation.getCurrentInventory(
node_uid=organisation.getUid(),
resource_uid=product.getUid()),
0)
inventory.deliver()
self.tic()
self.assertEqual(
self.portal.portal_simulation.getCurrentInventory(
node_uid=organisation.getUid(),
resource_uid=product.getUid()),
100)
inventory.cancel()
self.tic()
self.assertEqual(
self.portal.portal_simulation.getCurrentInventory(
node_uid=organisation.getUid(),
resource_uid=product.getUid()),
0)
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestInventory))
......
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