Commit 2f2b391f authored by Guillaume Michon's avatar Guillaume Michon

DeliveryLines which have cells are now catalogged with a 0 quantity. Test adapted.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3825 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 96d9871b
...@@ -56,7 +56,7 @@ from Products.ERP5Type import product_path ...@@ -56,7 +56,7 @@ from Products.ERP5Type import product_path
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from testOrder import TestOrderMixin from testOrder import TestOrderMixin
from Products.ERP5Form.ListBox import makeTreeList from Products.ERP5Form.Selection import DomainSelection
class Test(TestOrderMixin,ERP5TypeTestCase): class Test(TestOrderMixin,ERP5TypeTestCase):
""" """
...@@ -902,7 +902,7 @@ class Test(TestOrderMixin,ERP5TypeTestCase): ...@@ -902,7 +902,7 @@ class Test(TestOrderMixin,ERP5TypeTestCase):
action = transition_step['action'] action = transition_step['action']
LOG("Transiting '%s' on packing list %s" % (action, transition_step['id']), 0, '') LOG("Transiting '%s' on packing list %s" % (action, transition_step['id']), 0, '')
workflow_tool.doActionFor(transited_pl, action, packing_list_workflow) workflow_tool.doActionFor(transited_pl, action, packing_list_workflow)
transited_pl.recursiveImmediateReindexObject() transited_pl.recursiveImmediateReindexObject() # XXX
self.stepTic() self.stepTic()
get_transaction().commit() get_transaction().commit()
...@@ -916,6 +916,7 @@ class Test(TestOrderMixin,ERP5TypeTestCase): ...@@ -916,6 +916,7 @@ class Test(TestOrderMixin,ERP5TypeTestCase):
def stepTestGetInventoryWithSelectionReport(self, sequence=None, sequence_list=None, **kw): def stepTestGetInventoryWithSelectionReport(self, sequence=None, sequence_list=None, **kw):
""" """
""" """
organisation_list = sequence.get('organisation_list')
expected_values_list = [ expected_values_list = [
{'id':2, 'values':[{'date':DateTime()-28, 'inventory':280.5}, {'id':2, 'values':[{'date':DateTime()-28, 'inventory':280.5},
{'date':DateTime()-20, 'inventory':280.5}, {'date':DateTime()-20, 'inventory':280.5},
...@@ -939,35 +940,16 @@ class Test(TestOrderMixin,ERP5TypeTestCase): ...@@ -939,35 +940,16 @@ class Test(TestOrderMixin,ERP5TypeTestCase):
}, },
] ]
# for expected_values in expected_values_list: for expected_values in expected_values_list:
# organisation = organisation_list[expected_values['id']] domain_selection = DomainSelection(domain_dict = {'destination_section':organisation_list[expected_values['id']],
# url = organisation.getRelativeUrl() 'source_section':organisation_list[expected_values['id']]})
# values = expected_values['values'] values = expected_values['values']
# for value in values: for value in values:
# date = value['date'] date = value['date']
# e_inventory = value['inventory'] e_inventory = value['inventory']
# self._testGetInventory(expected=e_inventory, at_date=date, node=url) self._testGetInventory(expected=e_inventory, at_date=date, selection_domain=domain_selection)
simulation = self.getPortal().portal_simulation
resource_list = sequence.get('resource_list')
portal = self.getPortal()
resource_module = portal.getDefaultModule(self.resource_portal_type)
tree_list = makeTreeList(resource_module, simulation, None, "site", None, 0, None, None, "toto_selection", 10)
LOG('report_tree :', 0, tree_list)
# makeTreeList(here, form, root_dict, report_path, base_category, depth, unfolded_list, form_id, selection_name, report_depth, is_report_opened=1, sort_on = (('id', 'ASC'),))
#LOG('getInventory :', 0, simulation.getInventory(node=0, at_date=DateTime() - 28, selection_report=1))
for line in tree_list:
# {'Place1':portal.portal_categories.site.Place1}
LOG('asSqlExpression on line %s :' % line[0], 0, line[4].asSqlExpression())
tree_list = makeTreeList(resource_module, simulation, None, "site/Place1", None, 1, None, None, "toto_selection", 10)
LOG('report_tree :', 0, tree_list)
# makeTreeList(here, form, root_dict, report_path, base_category, depth, unfolded_list, form_id, selection_name, report_depth, is_report_opened=1, sort_on = (('id', 'ASC'),))
#LOG('getInventory :', 0, simulation.getInventory(node=0, at_date=DateTime() - 28, selection_report=1))
for line in tree_list:
#LOG('getInventory on line %s :' % line[0], 0, simulation.getInventory(section=0,
LOG('asSqlExpression on line %s :' % line[0], 0, line[4].asSqlExpression())
def stepTestGetInventoryListOnSection(self, sequence=None, sequence_list=None, **kw): def stepTestGetInventoryListOnSection(self, sequence=None, sequence_list=None, **kw):
""" """
Test getInventoryList on a section Test getInventoryList on a section
...@@ -1009,7 +991,7 @@ class Test(TestOrderMixin,ERP5TypeTestCase): ...@@ -1009,7 +991,7 @@ class Test(TestOrderMixin,ERP5TypeTestCase):
expected_list.append({ 'node_relative_url': 3, 'section_relative_url':0, 'resource_relative_url':2, 'inventory':-quantity }) expected_list.append({ 'node_relative_url': 3, 'section_relative_url':0, 'resource_relative_url':2, 'inventory':-quantity })
for i in [ [2,0,0], [2,0,1], [2,0,2], [3,0,0], [3,0,2], for i in [ [2,0,0], [2,0,1], [2,0,2], [3,0,0], [3,0,2],
[2,0,0], [2,0,1], [3,0,0], [3,0,2] ]: [2,0,0], [2,0,1], [3,0,0], [3,0,2] ]:
expected_list.append({ 'node_relative_url': i[0], 'section_relative_url':i[1], 'resource_relative_url':i[2], 'inventory':None }) expected_list.append({ 'node_relative_url': i[0], 'section_relative_url':i[1], 'resource_relative_url':i[2], 'inventory':0. }) #None })
item_dict = {'node':organisation_list, 'section':organisation_list, 'resource':resource_list} item_dict = {'node':organisation_list, 'section':organisation_list, 'resource':resource_list}
expected_l = expected_list[:] expected_l = expected_list[:]
...@@ -1048,7 +1030,7 @@ class Test(TestOrderMixin,ERP5TypeTestCase): ...@@ -1048,7 +1030,7 @@ class Test(TestOrderMixin,ERP5TypeTestCase):
quantity = (i + 0.) / 2 quantity = (i + 0.) / 2
expected_list.append({ 'node_relative_url': 2, 'section_relative_url':0, 'resource_relative_url':1, 'inventory':-quantity }) expected_list.append({ 'node_relative_url': 2, 'section_relative_url':0, 'resource_relative_url':1, 'inventory':-quantity })
for i in [ [2,0,0], [2,0,1], [2,0,2], [2,0,0], [2,0,1] ]: for i in [ [2,0,0], [2,0,1], [2,0,2], [2,0,0], [2,0,1] ]:
expected_list.append({ 'node_relative_url': i[0], 'section_relative_url':i[1], 'resource_relative_url':i[2], 'inventory':None }) expected_list.append({ 'node_relative_url': i[0], 'section_relative_url':i[1], 'resource_relative_url':i[2], 'inventory':0. })#None })
item_dict = {'node':organisation_list, 'section':organisation_list, 'resource':resource_list} item_dict = {'node':organisation_list, 'section':organisation_list, 'resource':resource_list}
expected_l = expected_list[:] expected_l = expected_list[:]
...@@ -1180,14 +1162,14 @@ class Test(TestOrderMixin,ERP5TypeTestCase): ...@@ -1180,14 +1162,14 @@ class Test(TestOrderMixin,ERP5TypeTestCase):
{'resource_relative_url':0, 'inventory':6.5 }, {'resource_relative_url':0, 'inventory':6.5 },
{'resource_relative_url':0, 'inventory':6.5 }, {'resource_relative_url':0, 'inventory':6.5 },
{'resource_relative_url':0, 'inventory':6.5 }, {'resource_relative_url':0, 'inventory':6.5 },
{'resource_relative_url':0, 'inventory':None }, # Sum of lines (quantity of lines is NULL) {'resource_relative_url':0, 'inventory':0.}, #None }, # Sum of lines (quantity of lines is NULL)
{'resource_relative_url':1, 'inventory':15.5 }, {'resource_relative_url':1, 'inventory':15.5 },
{'resource_relative_url':1, 'inventory':10. }, {'resource_relative_url':1, 'inventory':10. },
{'resource_relative_url':1, 'inventory':None }, # Sum of lines (quantity of lines is ULL) {'resource_relative_url':1, 'inventory':0. }, #None }, # Sum of lines (quantity of lines is ULL)
{'resource_relative_url':2, 'inventory':18.5 }, {'resource_relative_url':2, 'inventory':18.5 },
{'resource_relative_url':2, 'inventory':None }, # Sum of lines (quantity of lines is NULL) {'resource_relative_url':2, 'inventory':0. }, #None }, # Sum of lines (quantity of lines is NULL)
]), ]),
] ]
...@@ -1246,6 +1228,7 @@ class Test(TestOrderMixin,ERP5TypeTestCase): ...@@ -1246,6 +1228,7 @@ class Test(TestOrderMixin,ERP5TypeTestCase):
LOG('SQL Query was : ', 0, repr(simulation.getInventoryList(src__=1, **kw))) LOG('SQL Query was : ', 0, repr(simulation.getInventoryList(src__=1, **kw)))
self.failUnless(0) self.failUnless(0)
found = found_list[0] found = found_list[0]
LOG('found a line with inventory =', 0, repr(found['inventory']))
del expected[found['id']] del expected[found['id']]
# All inventory lines were found. Now check if some expected values remain # All inventory lines were found. Now check if some expected values remain
if len(expected) > 0: if len(expected) > 0:
...@@ -1374,13 +1357,7 @@ class Test(TestOrderMixin,ERP5TypeTestCase): ...@@ -1374,13 +1357,7 @@ class Test(TestOrderMixin,ERP5TypeTestCase):
if not run: return if not run: return
sequence_list = SequenceList() sequence_list = SequenceList()
get_inventory_test_sequence = 'TestGetInventoryListOnSection \ get_inventory_test_sequence= 'TestGetInventoryOnNode \
TestGetInventoryListOnNode \
TestGetInventoryListWithOmitInput \
TestGetInventoryListWithOmitOutput \
TestGetInventoryListWithGroupBy \
'
get_inventory_test_sequence+= 'TestGetInventoryOnNode \
TestGetInventoryOnVariationCategory \ TestGetInventoryOnVariationCategory \
TestGetInventoryOnPayment \ TestGetInventoryOnPayment \
TestGetInventoryOnSection \ TestGetInventoryOnSection \
...@@ -1395,16 +1372,20 @@ class Test(TestOrderMixin,ERP5TypeTestCase): ...@@ -1395,16 +1372,20 @@ class Test(TestOrderMixin,ERP5TypeTestCase):
TestGetInventoryOnMirrorSectionCategory \ TestGetInventoryOnMirrorSectionCategory \
TestGetInventoryOnResourceCategory \ TestGetInventoryOnResourceCategory \
TestGetInventoryOnVariationText \ TestGetInventoryOnVariationText \
TestGetInventoryWithSelectionReport \ '
#TestGetInventoryWithSelectionReport \
get_inventory_test_sequence += 'TestGetInventoryListOnSection \
TestGetInventoryListOnNode \
TestGetInventoryListWithOmitInput \
TestGetInventoryListWithOmitOutput \
TestGetInventoryListWithGroupBy \
TestGetNextNegativeInventoryDate \ TestGetNextNegativeInventoryDate \
' '
# XXX Methods which fail for now : # XXX stepTestGetInventoryWithSelectionReport is not launched yet, since it tests a behavior
# - TestGetInventoryWithSelectionReport -> # which does not exist yet
# problem with categories : makes a selection by using table category
# problem with makeTreeList : makes a tree using categories in portal_category, but
# this test uses some variations which are children of the resources
# => Fix in progress
# - TestGetInventoryList : uses InventoryBrain.py in /usr/lib/zope/Extensions, which is not up to date # - TestGetInventoryList : uses InventoryBrain.py in /usr/lib/zope/Extensions, which is not up to date
# => To update in RPMs # => To update in RPMs
...@@ -1418,7 +1399,7 @@ class Test(TestOrderMixin,ERP5TypeTestCase): ...@@ -1418,7 +1399,7 @@ class Test(TestOrderMixin,ERP5TypeTestCase):
Tic \ Tic \
CreateTestingCategories \ CreateTestingCategories \
Tic \ Tic \
' + get_inventory_test_sequence ' + get_inventory_test_sequence
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