Commit 518878e0 authored by Romain Courteaud's avatar Romain Courteaud

slapos_subscription_request: set trade_condition_type on temporary Sale Order

parent da4feb32
......@@ -6,19 +6,23 @@ if subscriber_person_value is None:
source_project_value = None
destination_project_value = None
trade_condition_type = None
item = None
if resource.getPortalType() == "Software Product":
source_project_value = project_value
trade_condition_type = "instance_tree"
elif resource.getPortalType() == "Service":
if resource.getRelativeUrl() == "service_module/slapos_compute_node_subscription":
if project_value is None:
raise AssertionError('A project is required for %s %s' % (resource.getRelativeUrl(), project_value))
destination_project_value = project_value
trade_condition_type = "compute_node"
elif resource.getRelativeUrl() == "service_module/slapos_virtual_master_subscription":
if project_value is None:
raise AssertionError('Project is required for %s %s' % (resource.getRelativeUrl(), project_value))
item = project_value
trade_condition_type = "virtual_master"
else:
raise NotImplementedError('Unsupported resource: %s' % resource.getRelativeUrl())
else:
......@@ -37,6 +41,7 @@ module = portal.portal_trash
tmp_sale_order = module.newContent(
portal_type='Sale Order',
temp_object=True,
trade_condition_type=trade_condition_type,
start_date=now,
destination_value=subscriber_person_value,
destination_section=source_section,
......
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