Commit 0a28c938 authored by Romain Courteaud's avatar Romain Courteaud

slapos_cloud: InstanceTree_getSoftwareProduct also return release and type variations

parent 78386ad8
# set default value of image_url to the panel's logo
image_url = "gadget_slapos_panel.png"
software_product = context.InstanceTree_getSoftwareProduct()
software_product, _, _ = context.InstanceTree_getSoftwareProduct()
if software_product is not None:
product_image_url = software_product.getDefaultImageAbsoluteUrl()
......
portal = context.getPortalObject()
url_string = context.getUrlString()
software_product = None
software_release = None
software_type = None
product_list = portal.portal_catalog(
portal_type="Software Product",
......@@ -9,13 +11,23 @@ product_list = portal.portal_catalog(
follow_up__uid=context.getFollowUpUid()
)
release = portal.portal_catalog.getResultValue(
software_release = portal.portal_catalog.getResultValue(
portal_type="Software Product Release Variation",
url_string=url_string,
parent_uid=[x.getUid() for x in product_list]
)
if release is not None:
software_product = release.getParentValue()
if software_release is not None:
software_product = software_release.getParentValue()
return software_product
software_type = portal.portal_catalog.getResultValue(
parent_uid=software_product.getUid(),
title=context.getSourceReference(),
portal_type="Software Product Type Variation"
)
if software_type is None:
software_release = None
software_product = None
return software_product, software_release, software_type
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