Commit 23d99751 authored by Romain Courteaud's avatar Romain Courteaud

slapos_panel: Person_addVirtualMaster: try to find trade condition with Trade...

slapos_panel: Person_addVirtualMaster: try to find trade condition with Trade Model Line and currency
parent 15a06aa5
...@@ -14,6 +14,16 @@ project.validate() ...@@ -14,6 +14,16 @@ project.validate()
# create the subscription request, which will lead to the Open Order # create the subscription request, which will lead to the Open Order
subscription_request = resource.Resource_createSubscriptionRequest(customer, [], project) subscription_request = resource.Resource_createSubscriptionRequest(customer, [], project)
# XXX How to specify the trade condition containing the currency and trade model lines?
specialise_value = subscription_request.getSpecialiseValue(portal_type="Sale Trade Condition")
if ((specialise_value is not None) and
(specialise_value.getPriceCurrency('') == '') and
(len(specialise_value.contentValues(portal_type="Trade Model Line")) == 0)):
specialise_value = specialise_value.getSpecialiseValue(portal_type="Sale Trade Condition")
if specialise_value is None:
raise ValueError('Could not find a Trade Condition with Trade Model Line')
# and create default assignments for the user # and create default assignments for the user
# who can manage compute nodes and create instances # who can manage compute nodes and create instances
""" """
...@@ -38,13 +48,11 @@ else: ...@@ -38,13 +48,11 @@ else:
sale_trade_condition = portal.sale_trade_condition_module.newContent( sale_trade_condition = portal.sale_trade_condition_module.newContent(
portal_type="Sale Trade Condition", portal_type="Sale Trade Condition",
reference=title, reference=title,
# XXX hardcoded specialise_value=specialise_value,
specialise="business_process_module/slapos_ultimate_business_process",
destination_project_value=project, destination_project_value=project,
source_value=subscription_request.getDestinationValue(), source_value=subscription_request.getDestinationValue(),
source_section_value=source_section_value, source_section_value=source_section_value,
#source_payment_value=seller_bank_account, #source_payment_value=seller_bank_account,
price_currency_value=subscription_request.getPriceCurrencyValue()
) )
sale_trade_condition.validate() sale_trade_condition.validate()
...@@ -58,13 +66,11 @@ else: ...@@ -58,13 +66,11 @@ else:
sale_trade_condition = portal.sale_trade_condition_module.newContent( sale_trade_condition = portal.sale_trade_condition_module.newContent(
portal_type="Sale Trade Condition", portal_type="Sale Trade Condition",
reference=title, reference=title,
# XXX hardcoded specialise_value=specialise_value,
specialise="business_process_module/slapos_ultimate_business_process",
source_project_value=project, source_project_value=project,
source_value=subscription_request.getDestinationValue(), source_value=subscription_request.getDestinationValue(),
source_section_value=source_section_value, source_section_value=source_section_value,
#source_payment_value=seller_bank_account, #source_payment_value=seller_bank_account,
price_currency_value=subscription_request.getPriceCurrencyValue()
) )
sale_trade_condition.validate() sale_trade_condition.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