Commit 56b40c65 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

override stepSplitAndDeferPackingList to use the new simulation API.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31312 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0d8d8b08
...@@ -105,15 +105,15 @@ class TestERP5SimulationMixin(TestPackingListMixin): ...@@ -105,15 +105,15 @@ class TestERP5SimulationMixin(TestPackingListMixin):
new_order_rule.validate() new_order_rule.validate()
class TestERP5Simulation(TestERP5SimulationMixin, TestPackingList): class TestERP5Simulation(TestERP5SimulationMixin, TestPackingList):
def _addSolverProcess(self, divergence, solver_portal_type): def _addSolverProcess(self, divergence, solver_portal_type, **kw):
solver_tool = self.portal.portal_solvers solver_tool = self.portal.portal_solvers
# create a solver process # create a solver process
solver_process = solver_tool.newContent(portal_type='Solver Process') solver_process = solver_tool.newContent(portal_type='Solver Process')
# create a target solver # create a target solver
solver = solver_process.newContent( solver = solver_process.newContent(
portal_type=solver_portal_type, portal_type=solver_portal_type,
delivery=divergence.getProperty('object_relative_url') delivery=divergence.getProperty('object_relative_url'),
) **kw)
# create a solver decision # create a solver decision
solver_decision = solver_process.newContent( solver_decision = solver_process.newContent(
portal_type='Solver Decision', portal_type='Solver Decision',
...@@ -147,6 +147,20 @@ class TestERP5Simulation(TestERP5SimulationMixin, TestPackingList): ...@@ -147,6 +147,20 @@ class TestERP5Simulation(TestERP5SimulationMixin, TestPackingList):
# then call solve() on solver process # then call solve() on solver process
solver_process.solve() solver_process.solve()
def stepSplitAndDeferPackingList(self, sequence=None, sequence_list=None, **kw):
"""
Do the split and defer action
"""
packing_list = sequence.get('packing_list')
quantity_divergence = [x for x in packing_list.getDivergenceList() \
if x.getProperty('tested_property') == 'quantity'][0]
kw = {'delivery_solver':'FIFO',
'start_date':self.datetime + 15,
'stop_date':self.datetime + 25}
solver_process = self._addSolverProcess(quantity_divergence,
'Quantity Split Solver', **kw)
solver_process.solve()
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestERP5Simulation)) suite.addTest(unittest.makeSuite(TestERP5Simulation))
......
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