Commit 5aaa1fba authored by Romain Courteaud's avatar Romain Courteaud

slapos_crm/panel: rename Project_createSupportRequestWithCausality to...

slapos_crm/panel: rename Project_createSupportRequestWithCausality to Project_createTicketWithCausality

Prepare support for new ticket portal types.
parent 7817397b
Pipeline #37681 failed with stage
in 0 seconds
...@@ -12,7 +12,8 @@ error_dict = context.ComputeNode_getReportedErrorDict() ...@@ -12,7 +12,8 @@ error_dict = context.ComputeNode_getReportedErrorDict()
if not error_dict['should_notify']: if not error_dict['should_notify']:
return return
support_request = project.Project_createSupportRequestWithCausality( support_request = project.Project_createTicketWithCausality(
'Support Request',
error_dict['ticket_title'], error_dict['ticket_title'],
error_dict['ticket_description'], error_dict['ticket_description'],
causality=context.getRelativeUrl(), causality=context.getRelativeUrl(),
......
portal = context.getPortalObject() portal = context.getPortalObject()
project = context project = context
monitor_service_uid = portal.service_module.slapos_crm_monitoring.getUid(), monitor_service_uid = portal.service_module.slapos_crm_monitoring.getUid()
causality_value = portal.restrictedTraverse(causality) causality_value = portal.restrictedTraverse(causality)
if portal.portal_catalog.getResultValue( if portal.portal_catalog.getResultValue(
portal_type='Support Request', portal_type=portal_type,
resource__uid=monitor_service_uid, resource__uid=monitor_service_uid,
simulation_state=["validated", "submitted", "suspended"], simulation_state=["validated", "submitted", "suspended"],
causality__uid=causality_value.getUid(), causality__uid=causality_value.getUid(),
...@@ -18,6 +18,7 @@ return destination_decision_value.Entity_createTicketFromTradeCondition( ...@@ -18,6 +18,7 @@ return destination_decision_value.Entity_createTicketFromTradeCondition(
portal.service_module.slapos_crm_monitoring.getRelativeUrl(), portal.service_module.slapos_crm_monitoring.getRelativeUrl(),
title, title,
text_content, text_content,
portal_type=portal_type,
source_project=project.getRelativeUrl(), source_project=project.getRelativeUrl(),
causality=causality causality=causality
) )
...@@ -50,11 +50,11 @@ ...@@ -50,11 +50,11 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>title, text_content, causality, destination_decision</string> </value> <value> <string>portal_type, title, text_content, causality, destination_decision</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Project_createSupportRequestWithCausality</string> </value> <value> <string>Project_createTicketWithCausality</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -28,7 +28,8 @@ for instance in software_instance_list: ...@@ -28,7 +28,8 @@ for instance in software_instance_list:
error_dict = instance.SoftwareInstance_getReportedErrorDict(tolerance=30) error_dict = instance.SoftwareInstance_getReportedErrorDict(tolerance=30)
if error_dict['should_notify']: if error_dict['should_notify']:
support_request = project.Project_createSupportRequestWithCausality( support_request = project.Project_createTicketWithCausality(
'Support Request',
error_dict['ticket_title'], error_dict['ticket_title'],
error_dict['ticket_description'], error_dict['ticket_description'],
causality=instance_tree.getRelativeUrl(), causality=instance_tree.getRelativeUrl(),
......
...@@ -95,9 +95,12 @@ if not keep_draft: ...@@ -95,9 +95,12 @@ if not keep_draft:
if portal.portal_workflow.isTransitionPossible(event, 'stop'): if portal.portal_workflow.isTransitionPossible(event, 'stop'):
event.stop(comment=comment) event.stop(comment=comment)
else: else:
event.plan(comment=comment) if portal.portal_workflow.isTransitionPossible(event, 'plan'):
event.start(comment=comment, send_mail=(portal_type == 'Mail Message')) event.plan(comment=comment)
event.stop(comment=comment) if portal.portal_workflow.isTransitionPossible(event, 'start'):
event.start(comment=comment, send_mail=(portal_type == 'Mail Message'))
if portal.portal_workflow.isTransitionPossible(event, 'stop'):
event.stop(comment=comment)
event.deliver(comment=comment) event.deliver(comment=comment)
return event return event
...@@ -227,17 +227,18 @@ class TestCRMPropertySheetConstraint(SlapOSTestCaseMixin): ...@@ -227,17 +227,18 @@ class TestCRMPropertySheetConstraint(SlapOSTestCaseMixin):
self.assertEqual([], self.assertEqual([],
event.Event_checkCustomerAsSourceOrDestinationConsistency()) event.Event_checkCustomerAsSourceOrDestinationConsistency())
class TestProject_createSupportRequestWithCausality(TestCRMSkinsMixin): class TestProject_createTicketWithCausality(TestCRMSkinsMixin):
def testProject_createSupportRequestWithCausality(self): def testProject_createTicketWithCausality(self):
self._makeComputeNode(self.project) self._makeComputeNode(self.project)
self._makeComplexComputeNode(self.project) self._makeComplexComputeNode(self.project)
new_id = self.generateNewId() new_id = self.generateNewId()
title = "TestProject_createSupportRequestWithCausality title %s" % (new_id) title = "TestProject_createTicketWithCausality title %s" % (new_id)
text_content = "Test Description %s" % (new_id) text_content = "Test Description %s" % (new_id)
ticket = self.project.Project_createSupportRequestWithCausality( ticket = self.project.Project_createTicketWithCausality(
'Support Request',
title=title, title=title,
text_content=text_content, text_content=text_content,
causality=self.compute_node.getRelativeUrl(), causality=self.compute_node.getRelativeUrl(),
...@@ -250,21 +251,24 @@ class TestProject_createSupportRequestWithCausality(TestCRMSkinsMixin): ...@@ -250,21 +251,24 @@ class TestProject_createSupportRequestWithCausality(TestCRMSkinsMixin):
self.tic() self.tic()
self.assertEqual(None, self.assertEqual(None,
self.project.Project_createSupportRequestWithCausality( self.project.Project_createTicketWithCausality(
'Support Request',
title=title, title=title,
text_content=text_content, text_content=text_content,
causality=self.compute_node.getRelativeUrl(), causality=self.compute_node.getRelativeUrl(),
destination_decision=self.person.getRelativeUrl())) destination_decision=self.person.getRelativeUrl()))
self.assertEqual(None, self.assertEqual(None,
self.project.Project_createSupportRequestWithCausality( self.project.Project_createTicketWithCausality(
'Support Request',
title="Some other title", title="Some other title",
text_content="Some other content", text_content="Some other content",
causality=self.compute_node.getRelativeUrl(), causality=self.compute_node.getRelativeUrl(),
destination_decision=self.person.getRelativeUrl())) destination_decision=self.person.getRelativeUrl()))
# Same tittle different causality # Same tittle different causality
ticket = self.project.Project_createSupportRequestWithCausality( ticket = self.project.Project_createTicketWithCausality(
'Support Request',
title=title, title=title,
text_content=text_content, text_content=text_content,
causality=self.start_requested_software_instance.getSpecialise(), causality=self.start_requested_software_instance.getSpecialise(),
...@@ -277,7 +281,8 @@ class TestProject_createSupportRequestWithCausality(TestCRMSkinsMixin): ...@@ -277,7 +281,8 @@ class TestProject_createSupportRequestWithCausality(TestCRMSkinsMixin):
self.tic() self.tic()
self.assertEqual(None, self.assertEqual(None,
self.project.Project_createSupportRequestWithCausality( self.project.Project_createTicketWithCausality(
'Support Request',
title="Some other title", title="Some other title",
text_content="Some other content", text_content="Some other content",
causality=self.start_requested_software_instance.getSpecialise(), causality=self.start_requested_software_instance.getSpecialise(),
......
...@@ -11,7 +11,8 @@ if context.getPortalType() == 'Project': ...@@ -11,7 +11,8 @@ if context.getPortalType() == 'Project':
project = context project = context
else: else:
project = context.getFollowUpValue() project = context.getFollowUpValue()
support_request = project.Project_createSupportRequestWithCausality( support_request = project.Project_createTicketWithCausality(
'Support Request',
title, title,
description, description,
causality=context.getRelativeUrl(), causality=context.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