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':
start_date = hosting_subscription.HostingSubscription_calculateSubscriptionStartDate()
# 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()
service = instance_tree.InstanceTree_getSoftwareProduct()
if (service is None) or (service.getUse() != 'trade/sale'):
raise NotImplementedError('No Software Product defined for %s' % instance_tree.getRelativeUrl())
#assert instance_tree.getPortalType() in service.getRequiredAggregatedPortalTypeList()
edit_kw = {
'quantity': 1,
'resource_value': service,
......@@ -152,7 +150,7 @@ if instance_tree.getCausalityState() == 'diverged':
if open_order_line is not None:
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.getBaseContribution() == 'base_amount/invoicing/discounted'
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