Commit 748a5036 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Do not use newContent. In the future, special GeneratedMovement class will be...

Do not use newContent. In the future, special GeneratedMovement class will be used everywhere so that it does not interfere with anything else. Or use SimulationMovement and change its portal type.

git-svn-id: https://svn.erp5.org/repos/public/erp5/sandbox/amount_generator@35005 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 32221849
...@@ -73,12 +73,14 @@ class MovementGeneratorMixin: ...@@ -73,12 +73,14 @@ class MovementGeneratorMixin:
# however it should be generic enough not to be overriden # however it should be generic enough not to be overriden
# by most classes # by most classes
# Results will be appended to result, objects created inside folder # Results will be appended to result, objects created inside folder
from Products.ERP5Type.Document import newTempMovement
result = [] result = []
if self._applied_rule is None: if self._applied_rule is None:
folder = self folder = self # Really useful ?
else: else:
folder = self._applied_rule folder = self._applied_rule
# Build a list of movement and business path # Build a list of movement and business path
id_index = 0
for input_movement, business_path in self \ for input_movement, business_path in self \
._getInputMovementAndPathTupleList(movement_list=movement_list, ._getInputMovementAndPathTupleList(movement_list=movement_list,
rounding=rounding): rounding=rounding):
...@@ -87,16 +89,17 @@ class MovementGeneratorMixin: ...@@ -87,16 +89,17 @@ class MovementGeneratorMixin:
# Update movement properties (class overridable) # Update movement properties (class overridable)
kw.update(self._getUpdatePropertyDict(input_movement)) kw.update(self._getUpdatePropertyDict(input_movement))
# And build temp movement of appropriate type # And build temp movement of appropriate type
simulation_movement = folder.newContent( simulation_movement = newTempMovement(folder,
temp_object=True, 'generated_movement_%s' % id_index)
**kw) simulation_movement._edit(**kw)
result.append(simulation_movement) result.append(simulation_movement)
id_index += 1
return result return result
def _getUpdatePropertyDict(self, input_movement): def _getUpdatePropertyDict(self, input_movement):
# Default implementation bellow can be overriden by subclasses # Default implementation bellow can be overriden by subclasses
return {'delivery': input_movement.getRelativeUrl(), return {'delivery': input_movement.getRelativeUrl(), # XXX-JPS empty is better
'portal_type': RuleMixin.movement_type} }
def _getTradePhaseList(self, input_movement, business_process): def _getTradePhaseList(self, input_movement, business_process):
if self._trade_phase_list: if self._trade_phase_list:
......
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