Commit 124fc001 authored by Romain Courteaud's avatar Romain Courteaud

slapos_accounting: how to find the service to use

parent 9f2e9559
...@@ -79,7 +79,24 @@ if instance_tree.getCausalityState() == 'diverged': ...@@ -79,7 +79,24 @@ if instance_tree.getCausalityState() == 'diverged':
hosting_subscription.validate() hosting_subscription.validate()
start_date = hosting_subscription.HostingSubscription_calculateSubscriptionStartDate() start_date = hosting_subscription.HostingSubscription_calculateSubscriptionStartDate()
edit_kw = {} # Search for matching resource
service_list = portal.portal_catalog(
# XXX Hardcoded as temporary
id='slapos_instance_subscription',
portal_type='Service',
validation_state='validated',
use__relative_url='use/trade/sale'
)
service = [x for x in service_list if instance_tree.getPortalType() in x.getRequiredAggregatedPortalTypeList()][0].getObject()
edit_kw = {
'quantity': 1,
'resource_value': service,
'quantity_unit': service.getQuantityUnit(),
'base_contribution_list': service.getBaseContributionList(),
'use': service.getUse(),
# XXX Hardcoded
'price': 1
}
subscription_request = instance_tree.getAggregateRelatedValue(portal_type="Subscription Request") subscription_request = instance_tree.getAggregateRelatedValue(portal_type="Subscription Request")
# Define the start date of the period, this can variates with the time. # Define the start date of the period, this can variates with the time.
# start_date_delta = 0 # start_date_delta = 0
......
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