Commit cd0cf8e4 authored by Romain Courteaud's avatar Romain Courteaud

slapos_accounting: use Software Product instead of the service slapos_instance_subscription

parent f30637ca
...@@ -80,14 +80,12 @@ if instance_tree.getCausalityState() == 'diverged': ...@@ -80,14 +80,12 @@ if instance_tree.getCausalityState() == 'diverged':
start_date = hosting_subscription.HostingSubscription_calculateSubscriptionStartDate() start_date = hosting_subscription.HostingSubscription_calculateSubscriptionStartDate()
# Search for matching resource # Search for matching resource
service_list = portal.portal_catalog( service = instance_tree.InstanceTree_getSoftwareProduct()
# XXX Hardcoded as temporary if (service is None) or (service.getUse() != 'trade/sale'):
id='slapos_instance_subscription', raise NotImplementedError('No Software Product defined for %s' % instance_tree.getRelativeUrl())
portal_type='Service',
validation_state='validated', #assert instance_tree.getPortalType() in service.getRequiredAggregatedPortalTypeList()
use__relative_url='use/trade/sale'
)
service = [x for x in service_list if instance_tree.getPortalType() in x.getRequiredAggregatedPortalTypeList()][0].getObject()
edit_kw = { edit_kw = {
'quantity': 1, 'quantity': 1,
'resource_value': service, 'resource_value': service,
...@@ -152,7 +150,7 @@ if instance_tree.getCausalityState() == 'diverged': ...@@ -152,7 +150,7 @@ if instance_tree.getCausalityState() == 'diverged':
if open_order_line is not None: if open_order_line is not None:
open_order = open_order_line.getParentValue() open_order = open_order_line.getParentValue()
assert open_order_line.getResource() == 'service_module/slapos_instance_subscription' assert open_order_line.getResource().startswith('software_product')
assert open_order_line.getQuantityUnit() == 'unit/piece' assert open_order_line.getQuantityUnit() == 'unit/piece'
assert open_order_line.getBaseContribution() == 'base_amount/invoicing/discounted' assert open_order_line.getBaseContribution() == 'base_amount/invoicing/discounted'
assert open_order_line.getBaseContributionList()[1] == 'base_amount/invoicing/taxable' assert open_order_line.getBaseContributionList()[1] == 'base_amount/invoicing/taxable'
......
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