Commit 45f7c33b authored by Jérome Perrin's avatar Jérome Perrin

fix getFutureTrackingList for movements in started state

parent 57cf5cdf
......@@ -2162,8 +2162,11 @@ class SimulationTool(BaseTool):
"""
Returns list of future inventory grouped by section or site
"""
kw['item.simulation_state'] = tuple(list(self.getPortalFutureInventoryStateList())
+ list(self.getPortalReservedInventoryStateList()) + list(self.getPortalCurrentInventoryStateList()))
kw['item.simulation_state'] = tuple(
list(self.getPortalFutureInventoryStateList()) + \
list(self.getPortalTransitInventoryStateList()) + \
list(self.getPortalReservedInventoryStateList()) + \
list(self.getPortalCurrentInventoryStateList()))
return self.getTrackingList(**kw)
#######################################################
......
......@@ -2253,7 +2253,7 @@ class TestInventoryStat(InventoryAPITestCase):
self.assertEquals(getInventoryStat(node_uid=node_uid)[0].stock_uid, 3)
class TestTrackingList(InventoryAPITestCase):
"""Tests Inventory Stat methods.
"""Tests Item Tracking
"""
def testNodeUid(self):
getTrackingList = self.getSimulationTool().getTrackingList
......@@ -2351,6 +2351,33 @@ class TestTrackingList(InventoryAPITestCase):
'%s=now - %i, aggregate should be at node %i but is at node %i' % \
(param_id, now - date, node_uid_to_node_number[location_uid], node_uid_to_node_number[uid_list[0]]))
def testFutureTrackingList(self):
movement = self._makeMovement(quantity=1, aggregate_value=self.item,)
getFutureTrackingList = self.portal.portal_simulation.getFutureTrackingList
node_uid = self.node.getUid()
for state in ('planned', 'ordered', 'confirmed', 'ready', 'started',
'stopped', 'delivered'):
movement.simulation_state = state
movement.reindexObject()
self.tic()
tracking_node_uid_list = [brain.node_uid for brain in
getFutureTrackingList(item=self.item.getRelativeUrl())]
self.assertEquals([node_uid], tracking_node_uid_list,
"%s != %s (state:%s)" % ([node_uid], tracking_node_uid_list, state))
for state in ('draft', 'cancelled', 'deleted'):
movement.simulation_state = state
movement.reindexObject()
self.tic()
tracking_node_uid_list = [brain.node_uid for brain in
getFutureTrackingList(item=self.item.getRelativeUrl())]
self.assertEquals([], tracking_node_uid_list,
"%s != %s (state:%s)" % ([], tracking_node_uid_list, state))
# TODO: missing tests for input=1 and output=1
class TestInventoryCacheTable(InventoryAPITestCase):
""" Test impact of creating cache entries into inventory_cache table
This is an optimisation on stock results to avoid reading all stock entries
......
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