Commit ee280f94 authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_trade: complete test

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