Commit 27da9470 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 a6900464
......@@ -14,6 +14,16 @@ project.validate()
# create the subscription request, which will lead to the Open Order
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
# who can manage compute nodes and create instances
"""
......@@ -38,13 +48,11 @@ else:
sale_trade_condition = portal.sale_trade_condition_module.newContent(
portal_type="Sale Trade Condition",
reference=title,
# XXX hardcoded
specialise="business_process_module/slapos_ultimate_business_process",
specialise_value=specialise_value,
destination_project_value=project,
source_value=subscription_request.getDestinationValue(),
source_section_value=source_section_value,
#source_payment_value=seller_bank_account,
price_currency_value=subscription_request.getPriceCurrencyValue()
)
sale_trade_condition.validate()
......@@ -58,13 +66,11 @@ else:
sale_trade_condition = portal.sale_trade_condition_module.newContent(
portal_type="Sale Trade Condition",
reference=title,
# XXX hardcoded
specialise="business_process_module/slapos_ultimate_business_process",
specialise_value=specialise_value,
source_project_value=project,
source_value=subscription_request.getDestinationValue(),
source_section_value=source_section_value,
#source_payment_value=seller_bank_account,
price_currency_value=subscription_request.getPriceCurrencyValue()
)
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