Commit e57403b1 authored by Romain Courteaud's avatar Romain Courteaud

slapos_cloud: break Base_getSupportRequestInProgress

Use causality category instead of aggregate, to link the Ticket to the context document (instance, node, ...).
Aggregate must be used to define the item of the movement resource.

Break the parameters and use the context to define the causality value.
parent e6f55e42
portal = context.getPortalObject() portal = context.getPortalObject()
aggregate_value = portal.restrictedTraverse(aggregate)
return portal.portal_catalog.getResultValue( return 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"],
default_aggregate_uid = aggregate_value.getUid(), causality__uid=context.getUid(),
) )
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>title, aggregate</string> </value> <value> <string>title</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -15,9 +15,8 @@ except KeyError: ...@@ -15,9 +15,8 @@ except KeyError:
aggregate_value = portal.restrictedTraverse(aggregate) aggregate_value = portal.restrictedTraverse(aggregate)
support_request_in_progress = person.Base_getSupportRequestInProgress( support_request_in_progress = aggregate_value.Base_getSupportRequestInProgress(
title=support_request_title, title=support_request_title
aggregate=aggregate
) )
if support_request_in_progress is not None: if support_request_in_progress is not None:
...@@ -32,7 +31,7 @@ support_request_in_progress = context.REQUEST.get("support_request_in_progress", ...@@ -32,7 +31,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() == support_request_title and \ if support_request and support_request.getTitle() == support_request_title and \
support_request.getAggregateUid() == aggregate_value.getUid(): support_request.getCausalityUid() == aggregate_value.getUid():
context.REQUEST.set("support_request_relative_url", support_request_in_progress) context.REQUEST.set("support_request_relative_url", support_request_in_progress)
return return
...@@ -46,7 +45,7 @@ support_request = portal.support_request_module.newContent( ...@@ -46,7 +45,7 @@ support_request = portal.support_request_module.newContent(
description = description, description = description,
start_date = DateTime(), start_date = DateTime(),
destination_decision=person.getRelativeUrl(), destination_decision=person.getRelativeUrl(),
aggregate_value=aggregate_value, causality_value=aggregate_value,
resource=resource resource=resource
) )
support_request.validate() support_request.validate()
......
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