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