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,6 +179,14 @@ class SolverProcess(XMLObject, ActiveProcess): ...@@ -179,6 +179,14 @@ class SolverProcess(XMLObject, ActiveProcess):
""" """
isTransitionPossible = self.getPortalObject().portal_workflow.isTransitionPossible isTransitionPossible = self.getPortalObject().portal_workflow.isTransitionPossible
for solver in self.contentValues(portal_type=self.getPortalObject().getPortalTargetSolverTypeList()): for solver in self.contentValues(portal_type=self.getPortalObject().getPortalTargetSolverTypeList()):
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'): if isTransitionPossible(solver, 'start_solving'):
solver.startSolving() solver.startSolving()
solver.activate(active_process=self, activate_kw=activate_kw).solve( solver.activate(active_process=self, activate_kw=activate_kw).solve(
......
...@@ -215,3 +215,21 @@ class SolverTypeInformation(Predicate, ERP5TypeInformation): ...@@ -215,3 +215,21 @@ class SolverTypeInformation(Predicate, ERP5TypeInformation):
method = getattr(solver, method_id) method = getattr(solver, method_id)
return method() 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