Commit 31586510 authored by Jérome Perrin's avatar Jérome Perrin

testItem: test expected behaviour of item tracking with transit movement

parent d561dd5b
......@@ -1094,6 +1094,56 @@ class TestItemScripts(ERP5TypeTestCase):
self.assertEqual(None,
self.item.Item_getCurrentSiteTitle(at_date=DateTime() - 2))
def test_item_current_location_and_transit_movement(self):
# a started packing list is still in transit, so we do not know its
# current location until it is delivered.
# https://lab.nexedi.com/nexedi/erp5/merge_requests/70
implicit_movement = self.portal.implicit_item_movement_module.newContent(
portal_type='Implicit Item Movement',
destination_value=self.mirror_node,
destination_section_value=self.mirror_section,
stop_date=DateTime() - 2,
aggregate_value=self.item,
)
implicit_movement.deliver()
packing_list = self.portal.sale_packing_list_module.newContent(
portal_type='Sale Packing List',
source_value=self.mirror_node,
source_section_value=self.mirror_section,
destination_value=self.node,
destination_section_value=self.section,
specialise_value=self.portal.business_process_module.erp5_default_business_process,
start_date=DateTime() - 1,)
line = packing_list.newContent(
portal_type='Sale Packing List Line',
quantity=1,
resource_value=self.product,
aggregate_value=self.item,)
packing_list.confirm()
self.tic()
self.assertEqual(self.mirror_node, self.item.Item_getCurrentSiteValue())
self.assertEqual('Mirror Node', self.item.Item_getCurrentSiteTitle())
self.assertEqual(self.mirror_section, self.item.Item_getCurrentOwnerValue())
self.assertEqual('Mirror Section', self.item.Item_getCurrentOwnerTitle())
packing_list.start()
self.tic()
# When movement is started, the item is still moving so we do not know it's location / ownership.
# In this case we just return None.
self.assertEqual(None, self.item.Item_getCurrentSiteValue())
self.assertEqual(None, self.item.Item_getCurrentSiteTitle())
self.assertEqual(None, self.item.Item_getCurrentOwnerValue())
self.assertEqual(None, self.item.Item_getCurrentOwnerTitle())
packing_list.stop()
self.tic()
self.assertEqual(self.node, self.item.Item_getCurrentSiteValue())
self.assertEqual('Node', self.item.Item_getCurrentSiteTitle())
self.assertEqual(self.section, self.item.Item_getCurrentOwnerValue())
self.assertEqual('Section', self.item.Item_getCurrentOwnerTitle())
# with cells
@reindex
def _makeSalePackingListCellWithVariation(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