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