Commit 6c1f63ca authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

add SolverTypeInformation.solve() that can be called with activity for temp...

add SolverTypeInformation.solve() that can be called with activity for temp solver process documents.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@36885 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d174c8d7
......@@ -179,8 +179,16 @@ class SolverProcess(XMLObject, ActiveProcess):
"""
isTransitionPossible = self.getPortalObject().portal_workflow.isTransitionPossible
for solver in self.contentValues(portal_type=self.getPortalObject().getPortalTargetSolverTypeList()):
if isTransitionPossible(solver, 'start_solving'):
solver.startSolving()
if solver.isTempObject():
solver_type = solver._getPortalTypeValue()
solver_type.activate(activate_kw=activate_kw).solve(
activate_kw=activate_kw,
delivery_list=solver.getDeliveryList(),
configuration_dict=solver.getConfigurationPropertyDict()
)
else:
if isTransitionPossible(solver, 'start_solving'):
solver.startSolving()
solver.activate(active_process=self, activate_kw=activate_kw).solve(
activate_kw=activate_kw)
......
......@@ -215,3 +215,21 @@ class SolverTypeInformation(Predicate, ERP5TypeInformation):
method = getattr(solver, method_id)
return method()
def solve(self, delivery_list=None, configuration_dict=None,
activate_kw=None, **kw):
if delivery_list is None:
return
if configuration_dict is None:
configuration_dict = {}
solver_process_tool = self.getPortalObject().portal_solver_processes
solver_process = solver_process_tool.newContent(
portal_type='Solver Process',
temp_object=True)
solver = solver_process.newContent(portal_type=self.getId(),
delivery_list=delivery_list)
solver.updateConfiguration(**configuration_dict)
if self.getPortalObject().portal_workflow.isTransitionPossible(
solver, 'start_solving'):
solver.startSolving()
solver.solve(activate_kw=activate_kw)
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