Commit 71b79d5e authored by Romain Courteaud's avatar Romain Courteaud

Fetch hosting subscription directly from instance

parent 848fc3e7
......@@ -132,19 +132,9 @@ def getSoftwareInstanceSecurityCategory(self, base_category_list, user_name,
category_dict.setdefault(base_category, []).extend(['role', 'role/instance'])
if base_category == "aggregate":
software_instance = software_instance_list[0]
current_delivery_line = self.portal_catalog.unrestrictedGetResultValue(
portal_type='Sale Packing List Line',
aggregate_uid=software_instance.getUid(),
simulation_state=self.getPortalCurrentInventoryStateList() + \
self.getPortalFutureInventoryStateList() + \
self.getPortalReservedInventoryStateList() + \
self.getPortalTransitInventoryStateList(),
sort_on=(('movement.start_date', 'DESC'),)
)
if current_delivery_line is not None:
hosting_item = current_delivery_line.getAggregateValue(portal_type='Hosting Subscription')
if hosting_item is not None:
category_dict.setdefault(base_category, []).append(hosting_item.getRelativeUrl())
hosting_item = software_instance.getAggregateValue(portal_type='Hosting Subscription')
if hosting_item is not None:
category_dict.setdefault(base_category, []).append(hosting_item.getRelativeUrl())
category_list.append(category_dict)
elif len(software_instance_list) > 1:
raise ConsistencyError, "Error: There is more than one Software Instance " \
......
......@@ -71,13 +71,11 @@ if obj.getPortalType() == \'Person\':\n
return [{\'aggregate\': open_sale_order.getRelativeUrl()}]\n
\n
if obj.getPortalType() == \'Software Instance\':\n
delivery_line = obj.getAggregateRelatedValue(portal_type=\'Sale Packing List Line\')\n
if delivery_line is not None:\n
hosting_subscription = delivery_line.getAggregateValue(portal_type=\'Hosting Subscription\')\n
if hosting_subscription is not None:\n
open_sale_order_line = hosting_subscription.getAggregateRelatedValue(portal_type=\'Open Sale Order Line\')\n
if open_sale_order_line is not None and open_sale_order_line.getParentValue().getValidationState() == \'validated\':\n
return [{\'aggregate\': open_sale_order_line.getParentValue().getRelativeUrl()}]\n
hosting_subscription = obj.getAggregateValue(portal_type=\'Hosting Subscription\')\n
if hosting_subscription is not None:\n
open_sale_order_line = hosting_subscription.getAggregateRelatedValue(portal_type=\'Open Sale Order Line\')\n
if open_sale_order_line is not None and open_sale_order_line.getParentValue().getValidationState() == \'validated\':\n
return [{\'aggregate\': open_sale_order_line.getParentValue().getRelativeUrl()}]\n
\n
return []\n
</string> </value>
......
517
\ No newline at end of file
518
\ No newline at end of file
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