Commit 019af095 authored by Sebastien Robin's avatar Sebastien Robin

Simulation Rules: do not specify list of portal types to getMovementList

getMovementList will already return appropriate movements, this is
redundancy and it prevent using DeliveryRootSimulationRule for some
Orders on some projects
parent 579c1db9
...@@ -80,7 +80,12 @@ class DeliveryRootSimulationRule(RuleMixin, MovementCollectionUpdaterMixin): ...@@ -80,7 +80,12 @@ class DeliveryRootSimulationRule(RuleMixin, MovementCollectionUpdaterMixin):
class DeliveryRuleMovementGenerator(MovementGeneratorMixin): class DeliveryRuleMovementGenerator(MovementGeneratorMixin):
def _getPortalDeliveryMovementTypeList(self): def _getPortalDeliveryMovementTypeList(self):
return self._rule.getPortalObject().getPortalDeliveryMovementTypeList() """
Allow to override to use only some particular types of delivery lines
# This is bad XXX-JPS - use use
"""
return None
def _getInputMovementList(self, movement_list=None, rounding=None): def _getInputMovementList(self, movement_list=None, rounding=None):
"""Input movement list comes from delivery""" """Input movement list comes from delivery"""
...@@ -89,8 +94,11 @@ class DeliveryRuleMovementGenerator(MovementGeneratorMixin): ...@@ -89,8 +94,11 @@ class DeliveryRuleMovementGenerator(MovementGeneratorMixin):
return [] return []
else: else:
result = [] result = []
for movement in delivery.getMovementList( movement_kw = {}
portal_type=self._getPortalDeliveryMovementTypeList()): movement_type_list = self._getPortalDeliveryMovementTypeList()
if movement_type_list:
movement_kw["portal_type"] = movement_type_list
for movement in delivery.getMovementList(**movement_kw):
simulation_movement_list = movement.getDeliveryRelatedValueList() simulation_movement_list = movement.getDeliveryRelatedValueList()
if not simulation_movement_list or self._applied_rule in ( if not simulation_movement_list or self._applied_rule in (
simulation_movement.getParentValue() simulation_movement.getParentValue()
......
...@@ -95,5 +95,4 @@ class OrderRuleMovementGenerator(MovementGeneratorMixin): ...@@ -95,5 +95,4 @@ class OrderRuleMovementGenerator(MovementGeneratorMixin):
if order is None: if order is None:
return [] return []
else: else:
return order.getMovementList( 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