Commit ce1ca1cb authored by Romain Courteaud's avatar Romain Courteaud

slapos_subscription_request: configure the Subscription Request like a Support Request.

Customer as destination_decision
parent 831d0d96
......@@ -10,13 +10,13 @@ trade_condition_type = None
item = None
if resource.getPortalType() == "Software Product":
source_project_value = project_value
destination_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
source_project_value = project_value
trade_condition_type = "compute_node"
elif resource.getRelativeUrl() == "service_module/slapos_virtual_master_subscription":
if project_value is None:
......@@ -30,8 +30,8 @@ else:
######################################################
# Find Sale Trade Condition and price
# source_section = subscriber_person_value.getCareerSubordination(subscriber_person_value.getRelativeUrl())
source_section = subscriber_person_value.getRelativeUrl()
# destination_section = subscriber_person_value.getCareerSubordination(subscriber_person_value.getRelativeUrl())
destination_section = subscriber_person_value.getRelativeUrl()
# Create a temp Sale Order to calculate the real price and find the trade condition
now = DateTime()
......@@ -44,7 +44,7 @@ tmp_sale_order = module.newContent(
trade_condition_type=trade_condition_type,
start_date=now,
destination_value=subscriber_person_value,
destination_section=source_section,
destination_section=destination_section,
#destination_decision_value=source_decision_value,
destination_project_value=destination_project_value,
source_project_value=source_project_value,
......@@ -108,10 +108,10 @@ else:
subscription_request = portal.subscription_request_module.newContent(
portal_type='Subscription Request',
temp_object=temp_object,
source_value=subscriber_person_value,
source_section_value=source_section,
source_decision_value=subscriber_person_value,
source_project_value=source_project_value,
destination_value=subscriber_person_value,
destination_section=destination_section,
destination_decision_value=subscriber_person_value,
destination_project_value=destination_project_value,
start_date=now,
effective_date=now,
resource_value=resource,
......@@ -121,9 +121,9 @@ subscription_request = portal.subscription_request_module.newContent(
quantity=1,
ledger="automated",
specialise_value=tmp_sale_order.getSpecialiseValue(),
destination=tmp_sale_order.getSource(),
destination_section=tmp_sale_order.getSourceSection(),
destination_project_value=destination_project_value,
source=tmp_sale_order.getSource(),
source_section=tmp_sale_order.getSourceSection(),
source_project_value=source_project_value,
price_currency=tmp_sale_order.getPriceCurrency(),
price=price,
# XXX activate_kw=activate_kw
......
......@@ -53,14 +53,14 @@ else:
open_order_edit_kw = dict(
start_date=start_date,
specialise_value=subscription_request.getSpecialiseValue(),
source_value=subscription_request.getDestinationValue(),
source_section_value=subscription_request.getDestinationSectionValue(),
source_decision_value=subscription_request.getDestinationDecisionValue(),
source_project_value=subscription_request.getDestinationProjectValue(),
destination_value=subscription_request.getSourceValue(),
destination_section_value=subscription_request.getSourceSectionValue(),
destination_decision_value=subscription_request.getSourceDecisionValue(),
destination_project_value=subscription_request.getSourceProjectValue(),
source_value=subscription_request.getSourceValue(),
source_section_value=subscription_request.getSourceSectionValue(),
source_decision_value=subscription_request.getSourceDecisionValue(),
source_project_value=subscription_request.getSourceProjectValue(),
destination_value=subscription_request.getDestinationValue(),
destination_section_value=subscription_request.getDestinationSectionValue(),
destination_decision_value=subscription_request.getDestinationDecisionValue(),
destination_project_value=subscription_request.getDestinationProjectValue(),
ledger_value=portal.portal_categories.ledger.automated,
causality_value=subscription_request,
price_currency_value=subscription_request.getPriceCurrencyValue(),
......
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