Commit 737028ad authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_crm: Use aggregate instead source_project to aggregate computers and Hosting Subscriptions

parent 4675c289
...@@ -5,4 +5,7 @@ ...@@ -5,4 +5,7 @@
<portal_type id="Regularisation Request Module"> <portal_type id="Regularisation Request Module">
<item>business_application</item> <item>business_application</item>
</portal_type> </portal_type>
<portal_type id="Support Request">
<item>aggregate</item>
</portal_type>
</base_category_list> </base_category_list>
\ No newline at end of file
from DateTime import DateTime from DateTime import DateTime
portal = context.getPortalObject() portal = context.getPortalObject()
source_project_value = portal.restrictedTraverse(source_relative_url) aggregate_value = portal.restrictedTraverse(source_relative_url)
if source_project_value.getPortalType() == "Computer": if aggregate_value.getPortalType() == "Computer":
destination_decision = source_project_value.getSourceAdministration() destination_decision = aggregate_value.getSourceAdministration()
elif source_project_value.getPortalType() == "Software Instance": elif aggregate_value.getPortalType() == "Software Instance":
destination_decision = source_project_value.getSpecialiseValue().getDestinationSection() destination_decision = aggregate_value.getSpecialiseValue().getDestinationSection()
elif source_project_value.getPortalType() == "Hosting Subscription": elif aggregate_value.getPortalType() == "Hosting Subscription":
destination_decision = source_project_value.getDestinationSection() destination_decision = aggregate_value.getDestinationSection()
elif source_project_value.getPortalType() == "Software Installation": elif aggregate_value.getPortalType() == "Software Installation":
destination_decision = source_project_value.getDestinationSection() destination_decision = aggregate_value.getDestinationSection()
else: else:
destination_decision = None destination_decision = None
...@@ -22,7 +22,7 @@ support_request_in_progress = portal.portal_catalog.getResultValue( ...@@ -22,7 +22,7 @@ support_request_in_progress = portal.portal_catalog.getResultValue(
portal_type = 'Support Request', portal_type = 'Support Request',
title = title, title = title,
simulation_state = ["validated", "submitted", "suspended"], simulation_state = ["validated", "submitted", "suspended"],
source_project_uid = source_project_value.getUid(), aggregate_uid = aggregate_value.getUid(),
) )
if support_request_in_progress is not None: if support_request_in_progress is not None:
...@@ -33,7 +33,7 @@ support_request_in_progress = context.REQUEST.get("support_request_in_progress", ...@@ -33,7 +33,7 @@ support_request_in_progress = context.REQUEST.get("support_request_in_progress",
if support_request_in_progress is not None: if support_request_in_progress is not None:
support_request = portal.restrictedTraverse(support_request_in_progress, None) support_request = portal.restrictedTraverse(support_request_in_progress, None)
if support_request and support_request.getTitle() == title and \ if support_request and support_request.getTitle() == title and \
support_request.getSourceProjectUid() == source_project_value.getUid(): support_request.getAggregatetUid() == aggregate_value.getUid():
return portal.restrictedTraverse(support_request_in_progress) return portal.restrictedTraverse(support_request_in_progress)
resource = portal.service_module.\ resource = portal.service_module.\
...@@ -48,7 +48,7 @@ support_request.edit( ...@@ -48,7 +48,7 @@ support_request.edit(
description = description, description = description,
start_date = DateTime(), start_date = DateTime(),
destination_decision=destination_decision, destination_decision=destination_decision,
source_project_value = source_project_value, aggregate_value = aggregate_value,
resource=resource resource=resource
) )
support_request.validate() support_request.validate()
......
...@@ -2168,7 +2168,7 @@ class TestSlapOSComputer_notifyWrongAllocationScope(testSlapOSMixin): ...@@ -2168,7 +2168,7 @@ class TestSlapOSComputer_notifyWrongAllocationScope(testSlapOSMixin):
portal_type = 'Support Request', portal_type = 'Support Request',
title = request_title, title = request_title,
simulation_state = 'suspended', simulation_state = 'suspended',
source_project_uid = computer.getUid() aggregate_uid = computer.getUid()
) )
return support_request return support_request
...@@ -2659,7 +2659,7 @@ class TestSlapOSGenerateSupportRequestForSlapOS(testSlapOSMixin): ...@@ -2659,7 +2659,7 @@ class TestSlapOSGenerateSupportRequestForSlapOS(testSlapOSMixin):
self.computer.getSourceAdministration()) self.computer.getSourceAdministration())
self.assertEquals(support_request.getTitle(), title) self.assertEquals(support_request.getTitle(), title)
self.assertEquals(support_request.getDescription(), title) self.assertEquals(support_request.getDescription(), title)
self.assertEquals(support_request.getSourceProjectValue(), self.assertEquals(support_request.getAggregateValue(),
self.computer) self.computer)
def test_software_instance_Base_generateSupportRequestForSlapOS(self): def test_software_instance_Base_generateSupportRequestForSlapOS(self):
...@@ -2685,7 +2685,7 @@ class TestSlapOSGenerateSupportRequestForSlapOS(testSlapOSMixin): ...@@ -2685,7 +2685,7 @@ class TestSlapOSGenerateSupportRequestForSlapOS(testSlapOSMixin):
hosting_subscription.getDestinationSection()) hosting_subscription.getDestinationSection())
self.assertEquals(support_request.getTitle(), title) self.assertEquals(support_request.getTitle(), title)
self.assertEquals(support_request.getDescription(), title) self.assertEquals(support_request.getDescription(), title)
self.assertEquals(support_request.getSourceProjectValue(), self.assertEquals(support_request.getAggregateValue(),
instance) instance)
def test_hosting_subscription_Base_generateSupportRequestForSlapOS(self): def test_hosting_subscription_Base_generateSupportRequestForSlapOS(self):
...@@ -2709,7 +2709,7 @@ class TestSlapOSGenerateSupportRequestForSlapOS(testSlapOSMixin): ...@@ -2709,7 +2709,7 @@ class TestSlapOSGenerateSupportRequestForSlapOS(testSlapOSMixin):
self.assertEquals(support_request.getTitle(), title) self.assertEquals(support_request.getTitle(), title)
self.assertEquals(support_request.getDescription(), title) self.assertEquals(support_request.getDescription(), title)
self.assertEquals(support_request.getSourceProjectValue(), self.assertEquals(support_request.getAggregateValue(),
hosting_subscription) hosting_subscription)
def test_software_installation_Base_generateSupportRequestForSlapOS(self): def test_software_installation_Base_generateSupportRequestForSlapOS(self):
...@@ -2733,7 +2733,7 @@ class TestSlapOSGenerateSupportRequestForSlapOS(testSlapOSMixin): ...@@ -2733,7 +2733,7 @@ class TestSlapOSGenerateSupportRequestForSlapOS(testSlapOSMixin):
self.assertEquals(support_request.getTitle(), title) self.assertEquals(support_request.getTitle(), title)
self.assertEquals(support_request.getDescription(), title) self.assertEquals(support_request.getDescription(), title)
self.assertEquals(support_request.getSourceProjectValue(), self.assertEquals(support_request.getAggregateValue(),
software_installation) software_installation)
...@@ -2858,7 +2858,7 @@ class TestSlapOSComputer_CheckState(testSlapOSMixin): ...@@ -2858,7 +2858,7 @@ class TestSlapOSComputer_CheckState(testSlapOSMixin):
portal_type = 'Support Request', portal_type = 'Support Request',
title = request_title, title = request_title,
simulation_state = 'validated', simulation_state = 'validated',
source_project_uid = computer_uid aggregate_uid = computer_uid
) )
return support_request return support_request
...@@ -3046,7 +3046,7 @@ class TestSlapOSHostingSubscription_createSupportRequestEvent(testSlapOSMixin): ...@@ -3046,7 +3046,7 @@ class TestSlapOSHostingSubscription_createSupportRequestEvent(testSlapOSMixin):
support_request = self.portal.portal_catalog.getResultValue( support_request = self.portal.portal_catalog.getResultValue(
portal_type = 'Support Request', portal_type = 'Support Request',
simulation_state = "validated", simulation_state = "validated",
source_project_uid = hosting_suscription_uid aggregate_uid = hosting_suscription_uid
) )
return support_request return support_request
...@@ -3433,7 +3433,7 @@ class TestSupportRequestTrySendNotificationMessage(testSlapOSMixin): ...@@ -3433,7 +3433,7 @@ class TestSupportRequestTrySendNotificationMessage(testSlapOSMixin):
support_request = self.portal.support_request_module.newContent(\ support_request = self.portal.support_request_module.newContent(\
title=title, description=title, title=title, description=title,
destination_decision=self.computer.getSourceAdministration(), destination_decision=self.computer.getSourceAdministration(),
source_project_value=self.computer.getRelativeUrl()) aggregate_value=self.computer.getRelativeUrl())
support_request.validate() support_request.validate()
self.tic() self.tic()
...@@ -3484,7 +3484,7 @@ class TestSupportRequestTrySendNotificationMessage(testSlapOSMixin): ...@@ -3484,7 +3484,7 @@ class TestSupportRequestTrySendNotificationMessage(testSlapOSMixin):
another_support_request = self.portal.support_request_module.newContent(\ another_support_request = self.portal.support_request_module.newContent(\
title=title, description=title, title=title, description=title,
destination_decision=self.computer.getSourceAdministration(), destination_decision=self.computer.getSourceAdministration(),
source_project_value=self.computer.getRelativeUrl()) aggregate_value=self.computer.getRelativeUrl())
another_support_request.validate() another_support_request.validate()
self.tic() self.tic()
......
Regularisation Request Module | business_application Regularisation Request Module | business_application
Regularisation Request | specialise Regularisation Request | specialise
Support Request | aggregate
\ 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