Commit ee280f94 authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_trade: complete test

parent a8d1e22e
......@@ -3,6 +3,10 @@ document = context
excluded_list = []
aggregate_dict = {}
# Make sure class is correct, otherwise we'll create duplicated quantity
if context.portal_types[document.getPortalType()].getTypeClass() == 'Inventory':
return
inventory_offset_line_list = document.contentValues(portal_type='Inventory Offset Line')
if inventory_offset_line_list:
document.manage_delObjects(ids=[x.getId() for x in inventory_offset_line_list])
......
......@@ -768,29 +768,43 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase):
sequence_list.play(self)
def test_08_upgradeInventoryProcess(self):
"""
def stepSetInventoryToIndexVersion(self, sequence=None):
portal = self.getPortal()
inventory = portal.portal_types.Inventory
inventory.setTypeClass('Inventory')
self.commit()
"""
def stepSetInventoryToNoindexVersion(self, sequence=None):
portal = self.getPortal()
inventory = portal.portal_types.Inventory
inventory.setTypeClass('NoIndexStockInventory')
self.commit()
@UnrestrictedMethod
def stepUpgradeInventory(self, sequence=None):
portal = self.getPortal()
portal.inventory_module.Inventory_removeOldMovement()
self.tic()
inventory = sequence.get('inventory_list')[-1]
inventory.Inventory_calculateInventoryOffset()
self.tic()
def test_08_upgradeInventoryProcess(self):
sequence_list = SequenceList()
# Test with a simple inventory without cell
sequence_string = 'stepCreateNotVariatedResource \
stepCreateOrganisation1 \
stepCreateInitialMovements \
stepSetInventoryToIndexVersion \
stepTic \
stepCreateFirstNotVariatedInventory \
stepTic \
stepCheckFirstNotVariatedInventory \
stepCreateSecondNotVariatedInventory \
stepSetInventoryToNoindexVersion \
stepTic \
stepCheckSecondNotVariatedInventory \
stepModifySecondNotVariatedInventory \
stepTic \
stepCheckSecondNotVariatedInventoryModified'
stepUpgradeInventory \
stepCheckFirstNotVariatedInventory'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(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