Commit 97ba4c62 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_accounting: If Hosting Subscription comes from Subscription Request...

slapos_accounting: If Hosting Subscription comes from Subscription Request apply Quantity and Pricing
parent 4fe16eae
...@@ -148,12 +148,22 @@ if (add_line_list): ...@@ -148,12 +148,22 @@ if (add_line_list):
open_sale_order_line = open_sale_order_line_template.Base_createCloneDocument(batch_mode=1, open_sale_order_line = open_sale_order_line_template.Base_createCloneDocument(batch_mode=1,
destination=open_sale_order) destination=open_sale_order)
start_date = hosting_subscription.HostingSubscription_calculateSubscriptionStartDate() start_date = hosting_subscription.HostingSubscription_calculateSubscriptionStartDate()
edit_kw = {}
subscription_request = hosting_subscription.getAggregateRelatedValue(portal_type="Subscription Request")
if subscription_request is not None:
edit_kw['quantity'] = subscription_request.getQuantity()
edit_kw['price'] = subscription_request.getPrice()
edit_kw['price_currency'] = subscription_request.getPriceCurrency()
open_sale_order_line.edit( open_sale_order_line.edit(
activate_kw=activate_kw, activate_kw=activate_kw,
title=hosting_subscription.getTitle(), title=hosting_subscription.getTitle(),
start_date=start_date, start_date=start_date,
stop_date=calculateOpenOrderLineStopDate(open_sale_order_line, hosting_subscription), stop_date=calculateOpenOrderLineStopDate(open_sale_order_line, hosting_subscription),
aggregate_value=hosting_subscription, aggregate_value=hosting_subscription,
**edit_kw
) )
storeWorkflowComment(open_sale_order_line, "Created for %s" % hosting_subscription.getRelativeUrl()) storeWorkflowComment(open_sale_order_line, "Created for %s" % hosting_subscription.getRelativeUrl())
if (hosting_subscription.getSlapState() == 'destroy_requested'): if (hosting_subscription.getSlapState() == 'destroy_requested'):
......
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