Commit c1bf4ba7 authored by Mame Coumba Sall's avatar Mame Coumba Sall

Add new test to test that when a new movement is added in the future

after full inventory, that the movement is part of the inventory
with or without optimisation


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29892 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ab9b2a1b
......@@ -1933,8 +1933,8 @@ class TestInventoryDocument(InventoryAPITestCase):
def test_01_CurrentInventoryWithFullInventory(self):
"""
Check that inventory optimisation is executed when querying current
amount (there is a usable full inventory which is the latest).
#Check that inventory optimisation is executed when querying current
#amount (there is a usable full inventory which is the latest).
"""
self.getInventoryEquals(value=self.INVENTORY_QUANTITY_3 + \
self.BASE_QUANTITY,
......@@ -1942,8 +1942,8 @@ class TestInventoryDocument(InventoryAPITestCase):
def test_02_InventoryAtLatestFullInventoryDate(self):
"""
Check that inventory optimisation is executed when querying an amount
at the exact time of latest usable full inventory.
#Check that inventory optimisation is executed when querying an amount
#at the exact time of latest usable full inventory.
"""
self.getInventoryEquals(value=self.INVENTORY_QUANTITY_3,
inventory_kw={'node_uid': self.node_uid,
......@@ -1951,8 +1951,8 @@ class TestInventoryDocument(InventoryAPITestCase):
def test_03_InventoryAtEarlierFullInventoryDate(self):
"""
Check that inventory optimisation is executed when querying past
amount (there is a usable full inventory which is not the latest).
#Check that inventory optimisation is executed when querying past
#amount (there is a usable full inventory which is not the latest).
"""
self.getInventoryEquals(value=self.INVENTORY_QUANTITY_2 + \
self.BASE_QUANTITY,
......@@ -1962,12 +1962,12 @@ class TestInventoryDocument(InventoryAPITestCase):
def test_04_InventoryBeforeFullInventoryAfterPartialInventory(self):
"""
Check that optimisation is not executed when querying past amount
with no usable full inventory.
#Check that optimisation is not executed when querying past amount
#with no usable full inventory.
If optimisation was executed,
self.INVENTORY_QUANTITY_1 * 2 + self.BASE_QUANTITY * 2
would be found.
#If optimisation was executed,
# self.INVENTORY_QUANTITY_1 * 2 + self.BASE_QUANTITY * 2
#would be found.
"""
self.assertEquals(self.ACTUAL_INVENTORY_QUANTITY_1 + \
self.BASE_QUANTITY * 2,
......@@ -1976,8 +1976,8 @@ class TestInventoryDocument(InventoryAPITestCase):
def test_05_InventoryListWithFullInventory(self):
"""
Check that inventory optimisation is executed when querying current
amount list (there is a usable full inventory which is the latest).
#Check that inventory optimisation is executed when querying current
#amount list (there is a usable full inventory which is the latest).
"""
inventory = self.getInventoryList(node_uid=self.node_uid)
reference_inventory = [
......@@ -2233,8 +2233,31 @@ class TestInventoryDocument(InventoryAPITestCase):
ti.property_sheet_list = ps_list
transaction.commit()
_aq_reset()
def test_15_InventoryAfterModificationInFuture(self):
"""
Test inventory after adding a new movement in future
"""
movement = self._makeMovement(quantity=self.BASE_QUANTITY*2,
start_date=self.INVENTORY_DATE_3 + 2,
simulation_state='delivered')
transaction.commit()
self.tic()
inventory_kw={'node_uid': self.node_uid,
'at_date': self.INVENTORY_DATE_3 +10}
value=self.INVENTORY_QUANTITY_3
# use optimisation
self.assertEquals(True,movement in self.resource.getCurrentInventoryList(
from_date=movement.getStartDate(),
node_uid=self.node_uid,
**inventory_kw))
# without optimisation
self.assertEquals(True,movement in self.resource.getCurrentInventoryList(
optimisation__=False,
from_date=movement.getStartDate(),
node_uid=self.node_uid,
**inventory_kw))
class TestUnitConversion(InventoryAPITestCase):
QUANTITY_UNIT_CATEGORIES = {
'unit': {'unit': 1, 'a_few': None},
......
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