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

simulation: don't look in request in action scripts

formulator passes arguments, no need to look in request by hand. Also
this makes scripts easier to test if passed arguments are used.
parent 6ed86df3
request = context.REQUEST
from Products.ERP5Type.Message import translateString
listbox = request.get('listbox')
line_list = context.Delivery_getSolverDecisionList(listbox=listbox)
if len(line_list) == 0:
kw["keep_items"] = {'portal_status_message': translateString("Workflow state may have been updated by other user. Please try again.")}
return context.Base_redirect(form_id, **kw)
for listbox_key in listbox:
listbox_dict = listbox[listbox_key]
line = [x for x in line_list if x.getPath() == listbox_key][0]
for listbox_dict in listbox:
line = [x for x in line_list if x.getPath() == listbox_dict['listbox_key']][0]
uid = line.getUid()
for prop in ('solver', 'solver_configuration', 'delivery_solver', 'comment',):
value = listbox_dict.get(prop, None)
......
......@@ -359,17 +359,17 @@ class TestERP5Simulation(TestPackingListMixin, SecurityTestCase):
# Choose 'Divergence Resolution' (Adopt Prevision)
solver_decision = solver_decision_list[0]
packing_list.REQUEST['listbox'] = {
solver_decision.getPath():
{'comment': '',
listbox = [{
'listbox_key':solver_decision.getPath(),
'comment': '',
'solver_configuration': DummySolverConfiguration(),
'solver': 'portal_solvers/Adopt Solver'}}
'solver': 'portal_solvers/Adopt Solver'}]
packing_list.Delivery_updateSolveDivergenceDialog()
packing_list.Delivery_updateSolveDivergenceDialog(listbox=listbox)
# Solve Divergences
self.assertEqual(
self._getPortalStatusMessage(packing_list.Delivery_submitSolveDivergenceDialog()),
self._getPortalStatusMessage(packing_list.Delivery_submitSolveDivergenceDialog(listbox=listbox)),
'Divergence solvers started in background.')
# SolverProcess.solve() called
......@@ -394,18 +394,18 @@ class TestERP5Simulation(TestPackingListMixin, SecurityTestCase):
self.assertEqual(len(packing_list.getSolverValueList()), 1)
self.assertEqual(len(packing_list.Delivery_getSolverDecisionList()), 0)
packing_list.REQUEST['listbox'] = {
solver_decision.getPath():
{'comment': '',
listbox = [{
'listbox_key':solver_decision.getPath(),
'comment': '',
'solver_configuration': DummySolverConfiguration(),
'solver': 'portal_solvers/Adopt Solver'}}
'solver': 'portal_solvers/Adopt Solver'}]
self.assertEqual(
self._getPortalStatusMessage(packing_list.Delivery_updateSolveDivergenceDialog()),
self._getPortalStatusMessage(packing_list.Delivery_updateSolveDivergenceDialog(listbox=listbox)),
'Workflow state may have been updated by other user. Please try again.')
self.assertEqual(
self._getPortalStatusMessage(packing_list.Delivery_submitSolveDivergenceDialog()),
self._getPortalStatusMessage(packing_list.Delivery_submitSolveDivergenceDialog(listbox=listbox)),
'Workflow state may have been updated by other user. Please try again.')
self.tic()
......
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