Commit ed4ffd36 authored by Romain Courteaud's avatar Romain Courteaud

slapos_subscription_request: add one more assertion

parent 6b9f81e2
......@@ -58,6 +58,10 @@ subscribed_item = open_order_movement.getAggregateValue(portal_type=['Instance T
if subscription_change_request.getAggregateUid() != subscribed_item.getUid():
return invalidate(subscription_change_request, 'Unhandled requested changes on: aggregate')
# Ensure destination is different
if subscription_change_request.getDestination() == open_sale_order.getDestination():
return invalidate(subscription_change_request, 'Expected change on: destination')
# Create new Open Sale Order
next_open_sale_order = subscription_change_request.SubscriptionRequest_createOpenSaleOrder()
current_date = getClosestDate(target_date=next_open_sale_order.getCreationDate(), precision='day')
......@@ -87,4 +91,4 @@ elif subscribed_item.getPortalType() == 'Project':
else:
raise NotImplementedError('Not implemented subscribed item')
return invalidate(subscription_change_request, 'Unknown requested changes')
return invalidate(subscription_change_request, 'New open order: %s' % next_open_sale_order.getRelativeUrl())
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