Commit e1b92f78 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

* no need to propagate temp_object argument to creating Solver Decision,...

* no need to propagate temp_object argument to creating Solver Decision, because if parent object is temp object, its childrean are also temp object.
* fix a bug that newSolverProcess() returns None for non-temp case.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@36746 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 77f705b7
...@@ -192,8 +192,7 @@ class SolverProcess(XMLObject, ActiveProcess): ...@@ -192,8 +192,7 @@ class SolverProcess(XMLObject, ActiveProcess):
this helps reducing CPU time. this helps reducing CPU time.
""" """
def buildSolverDecisionList(self, delivery_or_movement=None, def buildSolverDecisionList(self, delivery_or_movement=None):
temp_object=False):
""" """
Build (or rebuild) the solver decisions in the solver process Build (or rebuild) the solver decisions in the solver process
...@@ -239,7 +238,6 @@ class SolverProcess(XMLObject, ActiveProcess): ...@@ -239,7 +238,6 @@ class SolverProcess(XMLObject, ActiveProcess):
# Now build the solver decision instances based on the previous # Now build the solver decision instances based on the previous
# grouping # grouping
solver_decision_list = self.objectValues(portal_type='Solver Decision') solver_decision_list = self.objectValues(portal_type='Solver Decision')
index = 1
for solver_decision_key, movement_dict in solver_decision_dict.items(): for solver_decision_key, movement_dict in solver_decision_dict.items():
causality, delivery_list, solver_list = solver_decision_key causality, delivery_list, solver_list = solver_decision_key
matched_solver_decision_list = [ matched_solver_decision_list = [
...@@ -249,14 +247,7 @@ class SolverProcess(XMLObject, ActiveProcess): ...@@ -249,14 +247,7 @@ class SolverProcess(XMLObject, ActiveProcess):
if len(matched_solver_decision_list) > 0: if len(matched_solver_decision_list) > 0:
solver_decision_list.remove(matched_solver_decision_list[0]) solver_decision_list.remove(matched_solver_decision_list[0])
else: else:
if temp_object: new_decision = self.newContent(portal_type='Solver Decision')
new_decision = self.newContent(portal_type='Solver Decision',
temp_object=True,
#id=index,
uid='new_%s' % index)
index += 1
else:
new_decision = self.newContent(portal_type='Solver Decision')
new_decision._setDeliveryValueList(movement_dict.keys()) new_decision._setDeliveryValueList(movement_dict.keys())
new_decision._setCausality(solver_decision_key[0]) new_decision._setCausality(solver_decision_key[0])
# If we have only one available automatic solver, we just use it # If we have only one available automatic solver, we just use it
......
...@@ -92,8 +92,7 @@ class SolverProcessTool(BaseTool): ...@@ -92,8 +92,7 @@ class SolverProcessTool(BaseTool):
new_solver = self.newContent(portal_type='Solver Process', new_solver = self.newContent(portal_type='Solver Process',
temp_object=temp_object) temp_object=temp_object)
# And build decisions # And build decisions
new_solver.buildSolverDecisionList(delivery_or_movement=delivery_or_movement, new_solver.buildSolverDecisionList(delivery_or_movement)
temp_object=temp_object)
if not temp_object: if not temp_object:
# Append the solver process into the delivery's solver category # Append the solver process into the delivery's solver category
...@@ -104,4 +103,5 @@ class SolverProcessTool(BaseTool): ...@@ -104,4 +103,5 @@ class SolverProcessTool(BaseTool):
solver_list = delivery.getSolverValueList() solver_list = delivery.getSolverValueList()
solver_list.append(new_solver) solver_list.append(new_solver)
delivery.setSolverValueList(solver_list) delivery.setSolverValueList(solver_list)
return new_solver
return new_solver
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