Commit f2f4ba6a authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_accounting: Use specific trade condition if Hosting Subscription comes...

slapos_accounting: Use specific trade condition if Hosting Subscription comes from a Subscription Request

This allow the system differ the 2 scenarios.
parent 8df9ff0d
...@@ -27,8 +27,8 @@ select_kw.update( ...@@ -27,8 +27,8 @@ select_kw.update(
movement_list = portal.portal_catalog(**select_kw) movement_list = portal.portal_catalog(**select_kw)
specialise = portal.portal_preferences.getPreferredAggregatedSaleTradeCondition() specialise = portal.portal_preferences.getPreferredAggregatedSaleTradeCondition()
subscription_request_specialise = portal.portal_preferences.getPreferredAggregatedSubscriptionSaleTradeCondition()
temp_movement_list = [] temp_movement_list = []
id = 1
for movement in movement_list: for movement in movement_list:
if movement.getGroupingReference() is not None: if movement.getGroupingReference() is not None:
continue continue
...@@ -50,7 +50,11 @@ for movement in movement_list: ...@@ -50,7 +50,11 @@ for movement in movement_list:
else: else:
temp_movement.edit(price=0.0) temp_movement.edit(price=0.0)
hosting_subscription = movement.getAggregateValue(portal_type="Hosting Subscription")
if hosting_subscription is not None and \
hosting_subscription.getAggregateRelated(portal_type="Subscription Request"):
temp_movement.edit(specialise=subscription_request_specialise)
temp_movement_list.append(temp_movement) temp_movement_list.append(temp_movement)
id += 1
return temp_movement_list return temp_movement_list
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