Commit 603b4ddf authored by Łukasz Nowak's avatar Łukasz Nowak

Support the newest effective Open Order related to Item.

parent 114b7d9c
...@@ -270,15 +270,14 @@ class SubscriptionItem(Item, CompositionMixin, MovementGeneratorMixin, Periodici ...@@ -270,15 +270,14 @@ class SubscriptionItem(Item, CompositionMixin, MovementGeneratorMixin, Periodici
result = [] result = []
catalog_tool = getToolByName(self, 'portal_catalog') catalog_tool = getToolByName(self, 'portal_catalog')
# Try to find the source open order
open_order_movement_list = self.getAggregateRelatedValueList(
portal_type="Open Sale Order Line") # XXX-JPS Hard Coded
if not open_order_movement_list:
return result
# Now generate movements for each valid open order # Now generate movements for each valid open order
for movement in open_order_movement_list: # YXU-Why we have a list here? for movement in catalog_tool(portal_type="Open Sale Order Line",
if movement.getParentValue().getValidationState() in ('open', 'validated'): # XXX-JPS hard coding default_aggregate_uid=self.getUid(),
validation_state=('open', 'validated', 'archived'), # XXX-JPS hard coding
sort_on=(('effective_date', 'descending'),),
limit=1 # Note Luke: Support the newest Open Order which defines
# something for current subscription item
): # YXU-Why we have a list here?
resource = movement.getResource() resource = movement.getResource()
start_date = movement.getStartDate() start_date = movement.getStartDate()
stop_date = movement.getStopDate() stop_date = movement.getStopDate()
......
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