Commit 668187df authored by Romain Courteaud's avatar Romain Courteaud

slapos_panel: virtual master can be free, and instance payble

parent 50073928
...@@ -32,11 +32,11 @@ subscription_request.reindexObject(activate_kw=activate_kw) ...@@ -32,11 +32,11 @@ subscription_request.reindexObject(activate_kw=activate_kw)
# XXX How to specify the trade condition containing the currency and trade model lines? # XXX How to specify the trade condition containing the currency and trade model lines?
specialise_value = subscription_request.getSpecialiseValue(portal_type="Sale Trade Condition") specialise_value = subscription_request.getSpecialiseValue(portal_type="Sale Trade Condition")
if ((specialise_value is not None) and if ((specialise_value is not None) and
(specialise_value.getPriceCurrency('') == '') and
(len(specialise_value.contentValues(portal_type="Trade Model Line")) == 0)): (len(specialise_value.contentValues(portal_type="Trade Model Line")) == 0)):
specialise_value = specialise_value.getSpecialiseValue(portal_type="Sale Trade Condition") specialise_value = specialise_value.getSpecialiseValue(portal_type="Sale Trade Condition")
if specialise_value is None: if ((specialise_value is None) or
(len(specialise_value.contentValues(portal_type="Trade Model Line")) == 0)):
raise ValueError('Could not find a Trade Condition with Trade Model Line') 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
...@@ -56,7 +56,10 @@ customer.newContent( ...@@ -56,7 +56,10 @@ customer.newContent(
# Compute Node trade condition # Compute Node trade condition
if is_compute_node_payable: if is_compute_node_payable:
source_section_value = subscription_request.getSourceSectionValue(None) source_section_value = subscription_request.getSourceSectionValue(
default=subscription_request.getSourceValue(default=None, portal_type='Organisation'),
portal_type='Organisation'
)
if source_section_value is None: if source_section_value is None:
raise AssertionError('No source section found to generate the invoices') raise AssertionError('No source section found to generate the invoices')
title = 'Payable Compute Node for: %s' % project.getTitle() title = 'Payable Compute Node for: %s' % project.getTitle()
...@@ -79,7 +82,10 @@ sale_trade_condition.validate() ...@@ -79,7 +82,10 @@ sale_trade_condition.validate()
# Instance Tree trade condition # Instance Tree trade condition
if is_instance_tree_payable: if is_instance_tree_payable:
source_section_value = subscription_request.getSourceSectionValue(None) source_section_value = subscription_request.getSourceSectionValue(
default=subscription_request.getSourceValue(default=None, portal_type='Organisation'),
portal_type='Organisation'
)
if source_section_value is None: if source_section_value is None:
raise AssertionError('No source section found to generate the invoices') raise AssertionError('No source section found to generate the invoices')
title = 'Payable Instance Tree for: %s' % project.getTitle() title = 'Payable Instance Tree for: %s' % project.getTitle()
......
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