Commit 088f7b96 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

support BPM.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31940 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1e4d1a07
...@@ -36,6 +36,7 @@ from Products.ERP5.Document.Predicate import Predicate ...@@ -36,6 +36,7 @@ from Products.ERP5.Document.Predicate import Predicate
from Products.ERP5.mixin.rule import RuleMixin from Products.ERP5.mixin.rule import RuleMixin
from Products.ERP5.mixin.movement_collection_updater import \ from Products.ERP5.mixin.movement_collection_updater import \
MovementCollectionUpdaterMixin MovementCollectionUpdaterMixin
from Products.ERP5.mixin.movement_generator import MovementGeneratorMixin
from Products.ERP5.MovementCollectionDiff import _getPropertyAndCategoryList from Products.ERP5.MovementCollectionDiff import _getPropertyAndCategoryList
# XXX this class should be moved to Rule.py once new simulation is fully # XXX this class should be moved to Rule.py once new simulation is fully
...@@ -125,7 +126,7 @@ class InvoicingRule(Rule): ...@@ -125,7 +126,7 @@ class InvoicingRule(Rule):
# or destination. # or destination.
return (movement.getSource() is None or movement.getDestination() is None) return (movement.getSource() is None or movement.getDestination() is None)
class InvoicingRuleMovementGenerator(object): class InvoicingRuleMovementGenerator(MovementGeneratorMixin):
def getGeneratedMovementList(self, context, movement_list=None, def getGeneratedMovementList(self, context, movement_list=None,
rounding=False): rounding=False):
""" """
...@@ -135,8 +136,9 @@ class InvoicingRuleMovementGenerator(object): ...@@ -135,8 +136,9 @@ class InvoicingRuleMovementGenerator(object):
i.e. business paths are not taken into account. i.e. business paths are not taken into account.
""" """
ret = [] ret = []
for movement in [context.getParentValue(),]: for input_movement, business_path in self \
kw = _getPropertyAndCategoryList(movement) ._getInputMovementAndPathTupleList(context):
kw = self._getPropertyAndCategoryList(input_movement, business_path)
kw.update({'order':None,'delivery':None}) kw.update({'order':None,'delivery':None})
simulation_movement = context.newContent( simulation_movement = context.newContent(
portal_type=RuleMixin.movement_type, portal_type=RuleMixin.movement_type,
...@@ -144,3 +146,6 @@ class InvoicingRuleMovementGenerator(object): ...@@ -144,3 +146,6 @@ class InvoicingRuleMovementGenerator(object):
**kw) **kw)
ret.append(simulation_movement) ret.append(simulation_movement)
return ret return ret
def _getInputMovementList(self, context):
return [context.getParentValue(),]
...@@ -36,6 +36,7 @@ from Products.ERP5.Document.Predicate import Predicate ...@@ -36,6 +36,7 @@ from Products.ERP5.Document.Predicate import Predicate
from Products.ERP5.mixin.rule import RuleMixin from Products.ERP5.mixin.rule import RuleMixin
from Products.ERP5.mixin.movement_collection_updater import \ from Products.ERP5.mixin.movement_collection_updater import \
MovementCollectionUpdaterMixin MovementCollectionUpdaterMixin
from Products.ERP5.mixin.movement_generator import MovementGeneratorMixin
from Products.ERP5.MovementCollectionDiff import _getPropertyAndCategoryList from Products.ERP5.MovementCollectionDiff import _getPropertyAndCategoryList
# XXX this class should be moved to Rule.py once new simulation is fully # XXX this class should be moved to Rule.py once new simulation is fully
...@@ -128,7 +129,7 @@ class OrderRule(Rule): ...@@ -128,7 +129,7 @@ class OrderRule(Rule):
# or destination. # or destination.
return (movement.getSource() is None or movement.getDestination() is None) return (movement.getSource() is None or movement.getDestination() is None)
class OrderRuleMovementGenerator(object): class OrderRuleMovementGenerator(MovementGeneratorMixin):
def getGeneratedMovementList(self, context, movement_list=None, def getGeneratedMovementList(self, context, movement_list=None,
rounding=False): rounding=False):
""" """
...@@ -137,17 +138,23 @@ class OrderRuleMovementGenerator(object): ...@@ -137,17 +138,23 @@ class OrderRuleMovementGenerator(object):
XXX This implementation is very primitive, and does not support BPM, XXX This implementation is very primitive, and does not support BPM,
i.e. business paths are not taken into account. i.e. business paths are not taken into account.
""" """
order = context.getDefaultCausalityValue()
if order is None:
return []
ret = [] ret = []
for movement in order.getMovementList( for input_movement, business_path in self \
portal_type=order.getPortalOrderMovementTypeList()): ._getInputMovementAndPathTupleList(context):
kw = _getPropertyAndCategoryList(movement) kw = self._getPropertyAndCategoryList(input_movement, business_path)
simulation_movement = context.newContent( simulation_movement = context.newContent(
portal_type=RuleMixin.movement_type, portal_type=RuleMixin.movement_type,
temp_object=True, temp_object=True,
order_value=movement, order_value=input_movement,
**kw) **kw)
ret.append(simulation_movement) ret.append(simulation_movement)
return ret return ret
def _getInputMovementList(self, context):
"""Input movement list comes from order"""
order = context.getDefaultCausalityValue()
if order is None:
return []
else:
return order.getMovementList(
portal_type=order.getPortalOrderMovementTypeList())
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