Commit c21cc2ea authored by Romain Courteaud's avatar Romain Courteaud

slapos_accounting: do not create the open order if the software product can not be found

parent f913ce84
...@@ -79,15 +79,12 @@ if instance_tree.getCausalityState() == 'diverged': ...@@ -79,15 +79,12 @@ if instance_tree.getCausalityState() == 'diverged':
hosting_subscription.validate() hosting_subscription.validate()
start_date = hosting_subscription.HostingSubscription_calculateSubscriptionStartDate() start_date = hosting_subscription.HostingSubscription_calculateSubscriptionStartDate()
open_sale_order = newOpenOrder(start_date)
open_order_explanation = ""
# Add lines
open_order_line = open_sale_order.newContent(portal_type="Open Sale Order Line")
# Search for matching resource # Search for matching resource
service = instance_tree.InstanceTree_getSoftwareProduct() service = instance_tree.InstanceTree_getSoftwareProduct()
if (service is None) or (service.getUse() != 'trade/sale'): if (service is None) or (service.getUse() != 'trade/sale'):
raise NotImplementedError('No Software Product defined for %s' % instance_tree.getRelativeUrl()) # XXX Add comment on instance tree
return
#raise NotImplementedError('No Software Product defined for %s' % instance_tree.getRelativeUrl())
#assert instance_tree.getPortalType() in service.getRequiredAggregatedPortalTypeList() #assert instance_tree.getPortalType() in service.getRequiredAggregatedPortalTypeList()
software_release = portal.portal_catalog.getResultValue( software_release = portal.portal_catalog.getResultValue(
...@@ -101,6 +98,16 @@ if instance_tree.getCausalityState() == 'diverged': ...@@ -101,6 +98,16 @@ if instance_tree.getCausalityState() == 'diverged':
portal_type="Software Product Type Variation" portal_type="Software Product Type Variation"
) )
if software_type is None:
# XXX add comment on instance tree
return
open_sale_order = newOpenOrder(start_date)
open_order_explanation = ""
# Add lines
open_order_line = open_sale_order.newContent(portal_type="Open Sale Order Line")
resource_vcl = [ resource_vcl = [
'software_release/%s' % software_release.getRelativeUrl(), 'software_release/%s' % software_release.getRelativeUrl(),
'software_type/%s' % software_type.getRelativeUrl() 'software_type/%s' % software_type.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