Commit f20015d9 authored by Rafael Monnerat's avatar Rafael Monnerat

migrate Hosting Subscription to Instance Tree

See merge request nexedi/slapos.core!313
parents c8f72767 f5b96752
...@@ -117,7 +117,7 @@ list ...@@ -117,7 +117,7 @@ list
.. program-output:: python slapos help list .. program-output:: python slapos help list
List all deployed services owned by current user. List all deployed services owned by current user.
From SlapOS Master point of view, it should return the list of all non-destroyed Hosting Subscriptions. From SlapOS Master point of view, it should return the list of all non-destroyed Instance Trees.
.. ..
search search
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>active_sense_method_id</string> </key> <key> <string>active_sense_method_id</string> </key>
<value> <string>Alarm_requestUpdateHostingSubscriptionOpenSaleOrder</string> </value> <value> <string>Alarm_requestUpdateInstanceTreeOpenSaleOrder</string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>slapos_request_update_hosting_subscription_open_sale_order</string> </value> <value> <string>slapos_request_update_instance_tree_open_sale_order</string> </value>
</item> </item>
<item> <item>
<key> <string>periodicity_day_frequency</string> </key> <key> <string>periodicity_day_frequency</string> </key>
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Updates Open Sale Order for Hosting Subscription which does not have correct OSO</string> </value> <value> <string>Updates Open Sale Order for Instance Tree which does not have correct OSO</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
<value> <value>
<tuple> <tuple>
<string>Computer Partition</string> <string>Computer Partition</string>
<string>Hosting Subscription</string> <string>Instance Tree</string>
<string>Software Instance</string> <string>Software Instance</string>
<string>Software Release</string> <string>Software Release</string>
</tuple> </tuple>
...@@ -122,7 +122,7 @@ ...@@ -122,7 +122,7 @@
<value> <value>
<tuple> <tuple>
<string>Computer Partition</string> <string>Computer Partition</string>
<string>Hosting Subscription</string> <string>Instance Tree</string>
<string>Software Instance</string> <string>Software Instance</string>
<string>Software Release</string> <string>Software Release</string>
</tuple> </tuple>
......
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
<value> <value>
<tuple> <tuple>
<string>Computer Partition</string> <string>Computer Partition</string>
<string>Hosting Subscription</string> <string>Instance Tree</string>
<string>Software Instance</string> <string>Software Instance</string>
<string>Software Release</string> <string>Software Release</string>
</tuple> </tuple>
...@@ -122,7 +122,7 @@ ...@@ -122,7 +122,7 @@
<value> <value>
<tuple> <tuple>
<string>Computer Partition</string> <string>Computer Partition</string>
<string>Hosting Subscription</string> <string>Instance Tree</string>
<string>Software Instance</string> <string>Software Instance</string>
<string>Software Release</string> <string>Software Release</string>
</tuple> </tuple>
......
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
<key> <string>aggregated_portal_type</string> </key> <key> <string>aggregated_portal_type</string> </key>
<value> <value>
<tuple> <tuple>
<string>Hosting Subscription</string> <string>Instance Tree</string>
<string>Slave Instance</string> <string>Slave Instance</string>
<string>Software Instance</string> <string>Software Instance</string>
</tuple> </tuple>
......
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
<value> <value>
<tuple> <tuple>
<string>Computer Partition</string> <string>Computer Partition</string>
<string>Hosting Subscription</string> <string>Instance Tree</string>
<string>Software Instance</string> <string>Software Instance</string>
<string>Software Release</string> <string>Software Release</string>
</tuple> </tuple>
...@@ -122,7 +122,7 @@ ...@@ -122,7 +122,7 @@
<value> <value>
<tuple> <tuple>
<string>Computer Partition</string> <string>Computer Partition</string>
<string>Hosting Subscription</string> <string>Instance Tree</string>
<string>Software Instance</string> <string>Software Instance</string>
<string>Software Release</string> <string>Software Release</string>
</tuple> </tuple>
......
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
<portal_type id="Computer Consumption TioXML File"> <portal_type id="Computer Consumption TioXML File">
<item>SortIndex</item> <item>SortIndex</item>
</portal_type> </portal_type>
<portal_type id="Hosting Subscription"> <portal_type id="Instance Tree">
<item>SlapOSAccountingHostingSubscriptionConstraint</item> <item>SlapOSAccountingInstanceTreeConstraint</item>
</portal_type> </portal_type>
<portal_type id="Sale Invoice Transaction"> <portal_type id="Sale Invoice Transaction">
<item>SlapOSAccountingSaleInvoiceTransactionConstraint</item> <item>SlapOSAccountingSaleInvoiceTransactionConstraint</item>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<workflow>document_conversion_interaction_workflow, document_publication_workflow, edit_workflow</workflow> <workflow>document_conversion_interaction_workflow, document_publication_workflow, edit_workflow</workflow>
</chain> </chain>
<chain> <chain>
<type>Hosting Subscription</type> <type>Instance Tree</type>
<workflow>slapos_accounting_interaction_workflow, slapos_api_invoicing_workflow</workflow> <workflow>slapos_accounting_interaction_workflow, slapos_api_invoicing_workflow</workflow>
</chain> </chain>
<chain> <chain>
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>SlapOSAccountingHostingSubscriptionConstraint</string> </value> <value> <string>SlapOSAccountingInstanceTreeConstraint</string> </value>
</item> </item>
<item> <item>
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
</item> </item>
<item> <item>
<key> <string>constraint_portal_type</string> </key> <key> <string>constraint_portal_type</string> </key>
<value> <string>python: (\'Hosting Subscription\',)</string> </value> <value> <string>python: (\'Instance Tree\',)</string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>aggregate_hosting_subscription_constraint</string> </value> <value> <string>aggregate_instance_tree_constraint</string> </value>
</item> </item>
<item> <item>
<key> <string>int_index</string> </key> <key> <string>int_index</string> </key>
...@@ -58,19 +58,19 @@ ...@@ -58,19 +58,19 @@
</item> </item>
<item> <item>
<key> <string>message_arity_not_in_range</string> </key> <key> <string>message_arity_not_in_range</string> </key>
<value> <string>There should be one Hosting Subscription related</string> </value> <value> <string>There should be one Instance Tree related</string> </value>
</item> </item>
<item> <item>
<key> <string>message_arity_too_small</string> </key> <key> <string>message_arity_too_small</string> </key>
<value> <string>There should be one Hosting Subscription related</string> </value> <value> <string>There should be one Instance Tree related</string> </value>
</item> </item>
<item> <item>
<key> <string>message_arity_with_portal_type_not_in_range</string> </key> <key> <string>message_arity_with_portal_type_not_in_range</string> </key>
<value> <string>There should be one Hosting Subscription related</string> </value> <value> <string>There should be one Instance Tree related</string> </value>
</item> </item>
<item> <item>
<key> <string>message_arity_with_portal_type_too_small</string> </key> <key> <string>message_arity_with_portal_type_too_small</string> </key>
<value> <string>There should be one Hosting Subscription related</string> </value> <value> <string>There should be one Instance Tree related</string> </value>
</item> </item>
<item> <item>
<key> <string>min_arity</string> </key> <key> <string>min_arity</string> </key>
......
portal = context.getPortalObject() portal = context.getPortalObject()
portal.portal_catalog.searchAndActivate( portal.portal_catalog.searchAndActivate(
method_id='HostingSubscription_requestUpdateOpenSaleOrder', method_id='InstanceTree_requestUpdateOpenSaleOrder',
portal_type="Hosting Subscription", portal_type="Instance Tree",
causality_state="diverged", causality_state="diverged",
activate_kw={'tag': tag, 'priority': 2}, activate_kw={'tag': tag, 'priority': 2},
activity_count=10, activity_count=10,
packet_size=1, # HostingSubscription_trigger_Person_storeOpenSaleOrderJournal packet_size=1, # InstanceTree_trigger_Person_storeOpenSaleOrderJournal
) )
context.activate(after_tag=tag).getId() context.activate(after_tag=tag).getId()
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Alarm_requestUpdateHostingSubscriptionOpenSaleOrder</string> </value> <value> <string>Alarm_requestUpdateInstanceTreeOpenSaleOrder</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -4,11 +4,11 @@ if REQUEST is not None: ...@@ -4,11 +4,11 @@ if REQUEST is not None:
from erp5.component.module.DateUtils import getClosestDate from erp5.component.module.DateUtils import getClosestDate
hosting_subscription = context instance_tree = context
portal = context.getPortalObject() portal = context.getPortalObject()
workflow_item_list = portal.portal_workflow.getInfoFor( workflow_item_list = portal.portal_workflow.getInfoFor(
ob=hosting_subscription, ob=instance_tree,
name='history', name='history',
wf_id='instance_slap_interface_workflow') wf_id='instance_slap_interface_workflow')
start_date = None start_date = None
...@@ -18,8 +18,8 @@ for item in workflow_item_list: ...@@ -18,8 +18,8 @@ for item in workflow_item_list:
break break
if start_date is None: if start_date is None:
# Compatibility with old Hosting subscription # Compatibility with old Instance tree
start_date = hosting_subscription.getCreationDate() start_date = instance_tree.getCreationDate()
start_date = getClosestDate(target_date=start_date, precision='day') start_date = getClosestDate(target_date=start_date, precision='day')
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>HostingSubscription_calculateSubscriptionStartDate</string> </value> <value> <string>InstanceTree_calculateSubscriptionStartDate</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -4,13 +4,13 @@ if REQUEST is not None: ...@@ -4,13 +4,13 @@ if REQUEST is not None:
from erp5.component.module.DateUtils import addToDate, getClosestDate from erp5.component.module.DateUtils import addToDate, getClosestDate
hosting_subscription = context instance_tree = context
portal = context.getPortalObject() portal = context.getPortalObject()
#start_date = context.HostingSubscription_calculateSubscriptionStartDate() #start_date = context.InstanceTree_calculateSubscriptionStartDate()
workflow_item_list = portal.portal_workflow.getInfoFor( workflow_item_list = portal.portal_workflow.getInfoFor(
ob=hosting_subscription, ob=instance_tree,
name='history', name='history',
wf_id='instance_slap_interface_workflow') wf_id='instance_slap_interface_workflow')
result_date = None result_date = None
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>HostingSubscription_getHateoasInstanceList</string> </value> <value> <string>InstanceTree_calculateSubscriptionStopDate</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -8,5 +8,5 @@ if context.getCausalityState() == 'diverged': ...@@ -8,5 +8,5 @@ if context.getCausalityState() == 'diverged':
# Template document does not have person relation # Template document does not have person relation
if person is not None: if person is not None:
person.Person_storeOpenSaleOrderJournal() person.Person_storeOpenSaleOrderJournal()
# Person_storeOpenSaleOrderJournal should fix all divergent Hosting Subscription in one run # Person_storeOpenSaleOrderJournal should fix all divergent Instance Tree in one run
assert context.getCausalityState() == 'solved' assert context.getCausalityState() == 'solved'
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Person_requestHateoasHostingSubscription</string> </value> <value> <string>InstanceTree_requestUpdateOpenSaleOrder</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -82,7 +82,7 @@ for movement in movement_list: ...@@ -82,7 +82,7 @@ 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") instance_tree = movement.getAggregateValue(portal_type="Instance Tree")
if movement.getSpecialiseUid() in consumption_specialise_uid_list: if movement.getSpecialiseUid() in consumption_specialise_uid_list:
specialise_to_set = consumption_specialise specialise_to_set = consumption_specialise
...@@ -90,8 +90,8 @@ for movement in movement_list: ...@@ -90,8 +90,8 @@ for movement in movement_list:
person = movement.getDestinationValue() person = movement.getDestinationValue()
specialise_to_set = person.Person_getAggregatedSubscriptionSaleTradeConditionValue(subscription_request_specialise) specialise_to_set = person.Person_getAggregatedSubscriptionSaleTradeConditionValue(subscription_request_specialise)
if hosting_subscription is not None: if instance_tree is not None:
subscription = hosting_subscription.getAggregateRelated(portal_type="Subscription Request") subscription = instance_tree.getAggregateRelated(portal_type="Subscription Request")
if subscription is not None: if subscription is not None:
temp_movement.edit( temp_movement.edit(
specialise=specialise_to_set, specialise=specialise_to_set,
......
...@@ -38,14 +38,14 @@ def newOpenOrder(open_sale_order): ...@@ -38,14 +38,14 @@ def newOpenOrder(open_sale_order):
def storeWorkflowComment(document, comment): def storeWorkflowComment(document, comment):
portal.portal_workflow.doActionFor(document, 'edit_action', comment=comment) portal.portal_workflow.doActionFor(document, 'edit_action', comment=comment)
def calculateOpenOrderLineStopDate(open_order_line, hosting_subscription, start_date_delta, next_stop_date_delta=0): def calculateOpenOrderLineStopDate(open_order_line, instance_tree, start_date_delta, next_stop_date_delta=0):
end_date = hosting_subscription.HostingSubscription_calculateSubscriptionStopDate() end_date = instance_tree.InstanceTree_calculateSubscriptionStopDate()
if end_date is None: if end_date is None:
# Be sure that start date is different from stop date # Be sure that start date is different from stop date
# Consider the first period longer (delta), this allow us to change X days/months # Consider the first period longer (delta), this allow us to change X days/months
# On a first invoice. # On a first invoice.
next_stop_date = hosting_subscription.getNextPeriodicalDate( next_stop_date = instance_tree.getNextPeriodicalDate(
hosting_subscription.HostingSubscription_calculateSubscriptionStartDate() + start_date_delta) instance_tree.InstanceTree_calculateSubscriptionStartDate() + start_date_delta)
current_stop_date = next_stop_date current_stop_date = next_stop_date
# Ensure the invoice is generated 15 days in advance of the next period. # Ensure the invoice is generated 15 days in advance of the next period.
...@@ -53,7 +53,7 @@ def calculateOpenOrderLineStopDate(open_order_line, hosting_subscription, start_ ...@@ -53,7 +53,7 @@ def calculateOpenOrderLineStopDate(open_order_line, hosting_subscription, start_
# Return result should be < now, it order to provide stability in simulation (destruction if it happen should be >= now) # Return result should be < now, it order to provide stability in simulation (destruction if it happen should be >= now)
current_stop_date = next_stop_date current_stop_date = next_stop_date
next_stop_date = \ next_stop_date = \
hosting_subscription.getNextPeriodicalDate(current_stop_date) instance_tree.getNextPeriodicalDate(current_stop_date)
return addToDate(current_stop_date, to_add={'second': -1}) return addToDate(current_stop_date, to_add={'second': -1})
else: else:
...@@ -81,8 +81,8 @@ else: ...@@ -81,8 +81,8 @@ else:
delete_line_list = [] delete_line_list = []
add_line_list = [] add_line_list = []
updated_hosting_subscription_dict = {} updated_instance_tree_dict = {}
deleted_hosting_subscription_dict = {} deleted_instance_tree_dict = {}
if open_sale_order is not None: if open_sale_order is not None:
for open_order_line in open_sale_order.contentValues( for open_order_line in open_sale_order.contentValues(
...@@ -95,18 +95,18 @@ if open_sale_order is not None: ...@@ -95,18 +95,18 @@ if open_sale_order is not None:
assert current_stop_date is not None assert current_stop_date is not None
assert current_start_date < current_stop_date assert current_start_date < current_stop_date
hosting_subscription = open_order_line.getAggregateValue(portal_type='Hosting Subscription') instance_tree = open_order_line.getAggregateValue(portal_type='Instance Tree')
assert current_start_date == hosting_subscription.HostingSubscription_calculateSubscriptionStartDate() assert current_start_date == instance_tree.InstanceTree_calculateSubscriptionStartDate()
subscription_request = hosting_subscription.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.
next_stop_date_delta = 0 next_stop_date_delta = 0
if subscription_request is not None: if subscription_request is not None:
next_stop_date_delta = 46 next_stop_date_delta = 46
# First check if the hosting subscription has been correctly simulated (this script may run only once per year...) # First check if the instance tree has been correctly simulated (this script may run only once per year...)
stop_date = calculateOpenOrderLineStopDate(open_order_line, hosting_subscription, stop_date = calculateOpenOrderLineStopDate(open_order_line, instance_tree,
start_date_delta=0, next_stop_date_delta=next_stop_date_delta) start_date_delta=0, next_stop_date_delta=next_stop_date_delta)
if current_stop_date < stop_date: if current_stop_date < stop_date:
# Bingo, new subscription to generate # Bingo, new subscription to generate
...@@ -116,49 +116,49 @@ if open_sale_order is not None: ...@@ -116,49 +116,49 @@ if open_sale_order is not None:
storeWorkflowComment(open_order_line, storeWorkflowComment(open_order_line,
'Stop date updated to %s' % stop_date) 'Stop date updated to %s' % stop_date)
if hosting_subscription.getSlapState() == 'destroy_requested': if instance_tree.getSlapState() == 'destroy_requested':
# Line should be deleted # Line should be deleted
assert hosting_subscription.getCausalityState() == 'diverged' assert instance_tree.getCausalityState() == 'diverged'
delete_line_list.append(open_order_line.getId()) delete_line_list.append(open_order_line.getId())
hosting_subscription.converge(comment="Last open order: %s" % open_order_line.getRelativeUrl()) instance_tree.converge(comment="Last open order: %s" % open_order_line.getRelativeUrl())
deleted_hosting_subscription_dict[hosting_subscription.getRelativeUrl()] = None deleted_instance_tree_dict[instance_tree.getRelativeUrl()] = None
updated_hosting_subscription_dict[hosting_subscription.getRelativeUrl()] = None updated_instance_tree_dict[instance_tree.getRelativeUrl()] = None
elif (hosting_subscription.getCausalityState() == 'diverged'): elif (instance_tree.getCausalityState() == 'diverged'):
hosting_subscription.converge(comment="Nothing to do on open order.") instance_tree.converge(comment="Nothing to do on open order.")
updated_hosting_subscription_dict[hosting_subscription.getRelativeUrl()] = None updated_instance_tree_dict[instance_tree.getRelativeUrl()] = None
# Time to check the open order line to add (remaining diverged Hosting # Time to check the open order line to add (remaining diverged Hosting
# Subscription normally) # Subscription normally)
for hosting_subscription in portal.portal_catalog( for instance_tree in portal.portal_catalog(
portal_type='Hosting Subscription', portal_type='Instance Tree',
default_destination_section_uid=context.getUid(), default_destination_section_uid=context.getUid(),
causality_state="diverged"): causality_state="diverged"):
hosting_subscription = hosting_subscription.getObject() instance_tree = instance_tree.getObject()
if hosting_subscription.getCausalityState() == 'diverged': if instance_tree.getCausalityState() == 'diverged':
# Simply check that it has never been simulated # Simply check that it has never been simulated
if hosting_subscription.getSlapState() == 'destroy_requested': if instance_tree.getSlapState() == 'destroy_requested':
# Line should be deleted # Line should be deleted
open_order_line = portal.portal_catalog.getResultValue( open_order_line = portal.portal_catalog.getResultValue(
portal_type='Open Sale Order Line', portal_type='Open Sale Order Line',
default_aggregate_uid=hosting_subscription.getUid()) default_aggregate_uid=instance_tree.getUid())
if open_order_line is not None and open_order_line.getValidationState() == "invalidated": if open_order_line is not None and open_order_line.getValidationState() == "invalidated":
hosting_subscription.converge(comment="Last open order: %s" % open_order_line.getRelativeUrl()) instance_tree.converge(comment="Last open order: %s" % open_order_line.getRelativeUrl())
elif open_order_line is None: elif open_order_line is None:
# User has no Open Sale Order (likely), so we add the line to remove later. This allow us to charge # User has no Open Sale Order (likely), so we add the line to remove later. This allow us to charge
# eventual usage between the runs of the alarm. # eventual usage between the runs of the alarm.
add_line_list.append(hosting_subscription) add_line_list.append(instance_tree)
else: else:
assert len(portal.portal_catalog( assert len(portal.portal_catalog(
portal_type='Open Sale Order Line', portal_type='Open Sale Order Line',
default_aggregate_uid=hosting_subscription.getUid(), default_aggregate_uid=instance_tree.getUid(),
limit=1)) == 0 limit=1)) == 0
# Let's add # Let's add
add_line_list.append(hosting_subscription) add_line_list.append(instance_tree)
else: else:
# Should be in the list of lines to remove # Should be in the list of lines to remove
assert (hosting_subscription.getRelativeUrl() in deleted_hosting_subscription_dict) or \ assert (instance_tree.getRelativeUrl() in deleted_instance_tree_dict) or \
(hosting_subscription.getRelativeUrl() in updated_hosting_subscription_dict) (instance_tree.getRelativeUrl() in updated_instance_tree_dict)
manual_archive = False manual_archive = False
if (add_line_list): if (add_line_list):
...@@ -172,13 +172,13 @@ if (add_line_list): ...@@ -172,13 +172,13 @@ if (add_line_list):
added_line_list = [] added_line_list = []
open_sale_order_line_template = portal.restrictedTraverse( open_sale_order_line_template = portal.restrictedTraverse(
portal.portal_preferences.getPreferredOpenSaleOrderLineTemplate()) portal.portal_preferences.getPreferredOpenSaleOrderLineTemplate())
for hosting_subscription in add_line_list: for instance_tree in 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 = instance_tree.InstanceTree_calculateSubscriptionStartDate()
edit_kw = {} edit_kw = {}
subscription_request = hosting_subscription.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
if subscription_request is not None: if subscription_request is not None:
...@@ -204,20 +204,20 @@ if (add_line_list): ...@@ -204,20 +204,20 @@ if (add_line_list):
open_sale_order_line.edit( open_sale_order_line.edit(
activate_kw=activate_kw, activate_kw=activate_kw,
title=hosting_subscription.getTitle(), title=instance_tree.getTitle(),
start_date=start_date, start_date=start_date,
stop_date=calculateOpenOrderLineStopDate(open_sale_order_line, stop_date=calculateOpenOrderLineStopDate(open_sale_order_line,
hosting_subscription, start_date_delta=start_date_delta), instance_tree, start_date_delta=start_date_delta),
aggregate_value=hosting_subscription, aggregate_value=instance_tree,
**edit_kw **edit_kw
) )
storeWorkflowComment(open_sale_order_line, "Created for %s" % hosting_subscription.getRelativeUrl()) storeWorkflowComment(open_sale_order_line, "Created for %s" % instance_tree.getRelativeUrl())
if (hosting_subscription.getSlapState() == 'destroy_requested'): if (instance_tree.getSlapState() == 'destroy_requested'):
# Added line to delete immediately # Added line to delete immediately
delete_line_list.append(open_sale_order_line.getId()) delete_line_list.append(open_sale_order_line.getId())
hosting_subscription.converge(comment="Last open order: %s" % open_sale_order_line.getRelativeUrl()) instance_tree.converge(comment="Last open order: %s" % open_sale_order_line.getRelativeUrl())
else: else:
hosting_subscription.converge(comment="First open order: %s" % open_sale_order_line.getRelativeUrl()) instance_tree.converge(comment="First open order: %s" % open_sale_order_line.getRelativeUrl())
added_line_list.append(open_sale_order_line.getId()) added_line_list.append(open_sale_order_line.getId())
open_order_explanation += "Added %s." % str(added_line_list) open_order_explanation += "Added %s." % str(added_line_list)
......
...@@ -163,8 +163,8 @@ ...@@ -163,8 +163,8 @@
grouping_reference=aggregated_reference, grouping_reference=aggregated_reference,
default_resource_uid=context.service_module.slapos_instance_subscription.getUid(), default_resource_uid=context.service_module.slapos_instance_subscription.getUid(),
sort_on=[('default_aggregate_uid', 'ASC'), ('movement.start_date', 'ASC')])"> sort_on=[('default_aggregate_uid', 'ASC'), ('movement.start_date', 'ASC')])">
<tal:block tal:define="item_uid python: line.getAggregateUid(portal_type='Hosting Subscription'); <tal:block tal:define="item_uid python: line.getAggregateUid(portal_type='Instance Tree');
item_title python: line.getAggregateTitle(portal_type='Hosting Subscription'); item_title python: line.getAggregateTitle(portal_type='Instance Tree');
start_date python: line.getStartDate(); start_date python: line.getStartDate();
stop_date python: line.getStopDate(); stop_date python: line.getStopDate();
quantity python: line.getQuantity(); quantity python: line.getQuantity();
......
...@@ -10,7 +10,7 @@ subscription_delivery_specialise_uid_list = [q.getUid() for q in portal.portal_c ...@@ -10,7 +10,7 @@ subscription_delivery_specialise_uid_list = [q.getUid() for q in portal.portal_c
search_kw = { search_kw = {
'portal_type': 'Sale Packing List Line', 'portal_type': 'Sale Packing List Line',
'simulation_state': 'delivered', 'simulation_state': 'delivered',
# Default Aggregate UID to the hosting subscription? # Default Aggregate UID to the instance tree?
"parent_specialise_uid": subscription_delivery_specialise_uid_list, "parent_specialise_uid": subscription_delivery_specialise_uid_list,
'grouping_reference' : context.getReference()} 'grouping_reference' : context.getReference()}
......
...@@ -28,9 +28,9 @@ elif trade_condition == subscription_request_specialise: ...@@ -28,9 +28,9 @@ elif trade_condition == subscription_request_specialise:
specialise_filter_list = specialise_list specialise_filter_list = specialise_list
def test_for_subscription(movement, causality): def test_for_subscription(movement, causality):
hosting_subscription = movement.getAggregateValue(portal_type="Hosting Subscription") instance_tree = movement.getAggregateValue(portal_type="Instance Tree")
if hosting_subscription is not None: if instance_tree is not None:
return hosting_subscription.getAggregateRelated(portal_type="Subscription Request") == causality return instance_tree.getAggregateRelated(portal_type="Subscription Request") == causality
if movement.getCausality(portal_type="Subscription Request") is not None: if movement.getCausality(portal_type="Subscription Request") is not None:
return movement.getCausality(portal_type="Subscription Request") == causality return movement.getCausality(portal_type="Subscription Request") == causality
......
...@@ -37,10 +37,10 @@ def getPackingListLineForResource(resource_uid_list): ...@@ -37,10 +37,10 @@ def getPackingListLineForResource(resource_uid_list):
def setDetailLine(packing_list_line): def setDetailLine(packing_list_line):
start_date = DateTime(packing_list_line.getStartDate()).strftime('%Y/%m/%d') start_date = DateTime(packing_list_line.getStartDate()).strftime('%Y/%m/%d')
hosting_reference = packing_list_line.getAggregateReference( instance_tree_reference = packing_list_line.getAggregateReference(
portal_type='Hosting Subscription') portal_type='Instance Tree')
hosting_title = packing_list_line.getAggregateTitle( instance_tree_title = packing_list_line.getAggregateTitle(
portal_type='Hosting Subscription') portal_type='Instance Tree')
software_instance = packing_list_line.getAggregateValue( software_instance = packing_list_line.getAggregateValue(
portal_type='Software Instance') portal_type='Software Instance')
if software_instance is None: if software_instance is None:
...@@ -50,8 +50,8 @@ def setDetailLine(packing_list_line): ...@@ -50,8 +50,8 @@ def setDetailLine(packing_list_line):
#default_line = {'date': {'hosting_ref': ['hs_title', {'instance_ref': ['inst_title', ['res1', 'res2', 'resN'] ] } ] } } #default_line = {'date': {'hosting_ref': ['hs_title', {'instance_ref': ['inst_title', ['res1', 'res2', 'resN'] ] } ] } }
if not start_date in consumption_dict: if not start_date in consumption_dict:
# Add new date line # Add new date line
consumption_dict[start_date] = {hosting_reference: consumption_dict[start_date] = {instance_tree_reference:
[hosting_title, [instance_tree_title,
{instance_reference: {instance_reference:
[software_instance.getTitle(), [software_instance.getTitle(),
[0.0, 0.0] [0.0, 0.0]
...@@ -60,8 +60,8 @@ def setDetailLine(packing_list_line): ...@@ -60,8 +60,8 @@ def setDetailLine(packing_list_line):
] ]
} }
# Add new Hosting line # Add new Hosting line
if not hosting_reference in consumption_dict[start_date]: if not instance_tree_reference in consumption_dict[start_date]:
consumption_dict[start_date][hosting_reference] = [hosting_title, consumption_dict[start_date][instance_tree_reference] = [instance_tree_title,
{instance_reference: {instance_reference:
[software_instance.getTitle(), [software_instance.getTitle(),
[0.0, 0.0] [0.0, 0.0]
...@@ -69,16 +69,16 @@ def setDetailLine(packing_list_line): ...@@ -69,16 +69,16 @@ def setDetailLine(packing_list_line):
} }
] ]
# Add new instance line # Add new instance line
if not instance_reference in consumption_dict[start_date][hosting_reference][1]: if not instance_reference in consumption_dict[start_date][instance_tree_reference][1]:
consumption_dict[start_date][hosting_reference][1][instance_reference] = [ consumption_dict[start_date][instance_tree_reference][1][instance_reference] = [
software_instance.getTitle(), [0.0, 0.0] software_instance.getTitle(), [0.0, 0.0]
] ]
if packing_list_line.getResourceUid() == cpu_resource_uid: if packing_list_line.getResourceUid() == cpu_resource_uid:
quantity = round(float(packing_list_line.getQuantity()), 3) quantity = round(float(packing_list_line.getQuantity()), 3)
consumption_dict[start_date][hosting_reference][1][instance_reference][1][0] = quantity consumption_dict[start_date][instance_tree_reference][1][instance_reference][1][0] = quantity
elif packing_list_line.getResourceUid() == memory_resource_uid: elif packing_list_line.getResourceUid() == memory_resource_uid:
quantity = round( (float(packing_list_line.getQuantity())/1024.0), 3) quantity = round( (float(packing_list_line.getQuantity())/1024.0), 3)
consumption_dict[start_date][hosting_reference][1][instance_reference][1][1] = quantity consumption_dict[start_date][instance_tree_reference][1][instance_reference][1][1] = quantity
# Add CPU_LOAD consumption details # Add CPU_LOAD consumption details
...@@ -89,9 +89,9 @@ for packing_list_line in getPackingListLineForResource([cpu_resource_uid, ...@@ -89,9 +89,9 @@ for packing_list_line in getPackingListLineForResource([cpu_resource_uid,
consumption_list = [] consumption_list = []
for date in sorted(consumption_dict): for date in sorted(consumption_dict):
for hosting_key in sorted(consumption_dict[date]): for hosting_key in sorted(consumption_dict[date]):
hosting_title, instance_dict = consumption_dict[date][hosting_key] instance_tree_title, instance_dict = consumption_dict[date][hosting_key]
for instance_value_list in instance_dict.values(): for instance_value_list in instance_dict.values():
instance_title, values = instance_value_list instance_title, values = instance_value_list
consumption_list.append([date, hosting_title, instance_title, values[0], values[1]]) consumption_list.append([date, instance_tree_title, instance_title, values[0], values[1]])
return consumption_list return consumption_list
...@@ -64,7 +64,7 @@ else: ...@@ -64,7 +64,7 @@ else:
continue continue
subscription = instance.getSpecialiseValue( subscription = instance.getSpecialiseValue(
portal_type="Hosting Subscription") portal_type="Instance Tree")
try: try:
person = subscription.getDestinationSectionValue( person = subscription.getDestinationSectionValue(
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>HostingSubscription_getMostEcoEfficientSoftwareInstance</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
resource_uid = context.service_module.cpu_load_percent.getUid() resource_uid = context.service_module.cpu_load_percent.getUid()
return context.HostingSubscription_getStatForResource(resource_uid, **kw) return context.InstanceTree_getStatForResource(resource_uid, **kw)
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>HostingSubscription_getCPUStat</string> </value> <value> <string>InstanceTree_getCPUStat</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
resource_uid = context.service_module.disk_used.getUid() resource_uid = context.service_module.disk_used.getUid()
return context.HostingSubscription_getStatForResource(resource_uid, **kw) return context.InstanceTree_getStatForResource(resource_uid, **kw)
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>HostingSubscription_getDiskStat</string> </value> <value> <string>InstanceTree_getDiskStat</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
instance, delta_co2 = context.HostingSubscription_getMostEcoEfficientSoftwareInstance() instance, delta_co2 = context.InstanceTree_getMostEcoEfficientSoftwareInstance()
if instance is None: if instance is None:
return None return None
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>InstanceTree_getEcoReallocationInformation</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
resource_uid = context.service_module.memory_used.getUid() resource_uid = context.service_module.memory_used.getUid()
return context.HostingSubscription_getStatForResource(resource_uid, **kw) return context.InstanceTree_getStatForResource(resource_uid, **kw)
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>HostingSubscription_getMemoryStat</string> </value> <value> <string>InstanceTree_getMemoryStat</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>HostingSubscription_getDefaultImageAbsoluteUrl</string> </value> <value> <string>InstanceTree_getMostEcoEfficientSoftwareInstance</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -6,12 +6,12 @@ portal = context.getPortalObject() ...@@ -6,12 +6,12 @@ portal = context.getPortalObject()
start_date = query_kw.pop('start_date', None) start_date = query_kw.pop('start_date', None)
stop_date = query_kw.pop('stop_date', None) stop_date = query_kw.pop('stop_date', None)
software_instance_uid = query_kw.pop('software_instance', None) software_instance_uid = query_kw.pop('software_instance', None)
hosting_subscription_uid = query_kw.pop('hosting_subscription_uid', None) instance_tree_uid = query_kw.pop('instance_tree_uid', None)
resource_uid = query_kw.pop('resource_service', None) resource_uid = query_kw.pop('resource_service', None)
comparison_operator = query_kw.pop('resource_operator', None) comparison_operator = query_kw.pop('resource_operator', None)
resource_value = query_kw.pop('resource_value', None) resource_value = query_kw.pop('resource_value', None)
if not software_instance_uid and not hosting_subscription_uid: if not software_instance_uid and not instance_tree_uid:
return [] return []
if start_date: if start_date:
...@@ -22,25 +22,25 @@ if stop_date: ...@@ -22,25 +22,25 @@ if stop_date:
if software_instance_uid and software_instance_uid != 'all': if software_instance_uid and software_instance_uid != 'all':
query_kw['aggregate_uid'] = software_instance_uid query_kw['aggregate_uid'] = software_instance_uid
elif hosting_subscription_uid and hosting_subscription_uid != 'all': elif instance_tree_uid and instance_tree_uid != 'all':
query_kw['aggregate_uid'] = hosting_subscription_uid query_kw['aggregate_uid'] = instance_tree_uid
elif context.getPortalType() == 'Person': elif context.getPortalType() == 'Person':
validation_state = query_kw.pop('hosting_validation_state', None) validation_state = query_kw.pop('hosting_validation_state', None)
hosting_uid_list = [] instance_tree_uid_list = []
for subscription in portal.portal_catalog( for subscription in portal.portal_catalog(
portal_type='Hosting Subscription', portal_type='Instance Tree',
validation_state=validation_state, validation_state=validation_state,
default_destination_section_uid=context.getUid()): default_destination_section_uid=context.getUid()):
if validation_state == 'validated' and subscription.getSlapState() == 'destroy_requested': if validation_state == 'validated' and subscription.getSlapState() == 'destroy_requested':
continue continue
if validation_state == 'archived' and subscription.getSlapState() != 'destroy_requested': if validation_state == 'archived' and subscription.getSlapState() != 'destroy_requested':
continue continue
hosting_uid_list.append(subscription.getUid()) instance_tree_uid_list.append(subscription.getUid())
if hosting_uid_list: if instance_tree_uid_list:
query_kw['aggregate_uid'] = hosting_uid_list query_kw['aggregate_uid'] = instance_tree_uid_list
else: else:
return [] return []
elif context.getPortalType() in ['Software Instance', 'Hosting Subscription', elif context.getPortalType() in ['Software Instance', 'Instance Tree',
'Computer']: 'Computer']:
query_kw['aggregate_uid'] = context.getUid() query_kw['aggregate_uid'] = context.getUid()
else: else:
...@@ -66,7 +66,7 @@ def getPackingListLineForResource(resource_uid_list): ...@@ -66,7 +66,7 @@ def getPackingListLineForResource(resource_uid_list):
def setDetailLine(packing_list_line): def setDetailLine(packing_list_line):
start_date = DateTime(packing_list_line.getStartDate()).strftime('%Y/%m/%d') start_date = DateTime(packing_list_line.getStartDate()).strftime('%Y/%m/%d')
hosting_s = packing_list_line.getAggregateValue( hosting_s = packing_list_line.getAggregateValue(
portal_type='Hosting Subscription') portal_type='Instance Tree')
software_instance = packing_list_line.getAggregateValue( software_instance = packing_list_line.getAggregateValue(
portal_type='Software Instance') portal_type='Software Instance')
computer_partition = packing_list_line.getAggregateValue( computer_partition = packing_list_line.getAggregateValue(
...@@ -74,7 +74,7 @@ def setDetailLine(packing_list_line): ...@@ -74,7 +74,7 @@ def setDetailLine(packing_list_line):
if software_instance is None: if software_instance is None:
# In case we found SPL line not aggregated to instance and hosting # In case we found SPL line not aggregated to instance and hosting
return return
hosting_reference = hosting_s.getReference() instance_tree_reference = hosting_s.getReference()
instance_reference = software_instance.getReference() instance_reference = software_instance.getReference()
computer_title = "" computer_title = ""
if computer_partition is not None: if computer_partition is not None:
...@@ -83,7 +83,7 @@ def setDetailLine(packing_list_line): ...@@ -83,7 +83,7 @@ def setDetailLine(packing_list_line):
#default_line = {'date': {'hosting_ref': ['hs_title', {'instance_ref': ['inst_title', ['res1', 'res2', 'resN'] ] } ] } } #default_line = {'date': {'hosting_ref': ['hs_title', {'instance_ref': ['inst_title', ['res1', 'res2', 'resN'] ] } ] } }
if not start_date in consumption_dict: if not start_date in consumption_dict:
# Add new date line # Add new date line
consumption_dict[start_date] = {hosting_reference: consumption_dict[start_date] = {instance_tree_reference:
[hosting_s.getTitle(), [hosting_s.getTitle(),
{instance_reference: {instance_reference:
[software_instance.getTitle(), [software_instance.getTitle(),
...@@ -96,8 +96,8 @@ def setDetailLine(packing_list_line): ...@@ -96,8 +96,8 @@ def setDetailLine(packing_list_line):
] ]
} }
# Add new Hosting line # Add new Hosting line
if not hosting_reference in consumption_dict[start_date]: if not instance_tree_reference in consumption_dict[start_date]:
consumption_dict[start_date][hosting_reference] = [hosting_s.getTitle(), consumption_dict[start_date][instance_tree_reference] = [hosting_s.getTitle(),
{instance_reference: {instance_reference:
[software_instance.getTitle(), [software_instance.getTitle(),
[0.0, 0.0, 0.0], [0.0, 0.0, 0.0],
...@@ -108,20 +108,20 @@ def setDetailLine(packing_list_line): ...@@ -108,20 +108,20 @@ def setDetailLine(packing_list_line):
hosting_s.getRelativeUrl() hosting_s.getRelativeUrl()
] ]
# Add new instance line # Add new instance line
if not instance_reference in consumption_dict[start_date][hosting_reference][1]: if not instance_reference in consumption_dict[start_date][instance_tree_reference][1]:
consumption_dict[start_date][hosting_reference][1][instance_reference] = [ consumption_dict[start_date][instance_tree_reference][1][instance_reference] = [
software_instance.getTitle(), [0.0, 0.0, 0.0], software_instance.getRelativeUrl(), software_instance.getTitle(), [0.0, 0.0, 0.0], software_instance.getRelativeUrl(),
computer_title computer_title
] ]
if packing_list_line.getResourceUid() == cpu_resource_uid: if packing_list_line.getResourceUid() == cpu_resource_uid:
quantity = round(float(packing_list_line.getQuantity()), 3) quantity = round(float(packing_list_line.getQuantity()), 3)
consumption_dict[start_date][hosting_reference][1][instance_reference][1][0] = quantity consumption_dict[start_date][instance_tree_reference][1][instance_reference][1][0] = quantity
elif packing_list_line.getResourceUid() == memory_resource_uid: elif packing_list_line.getResourceUid() == memory_resource_uid:
quantity = round( float(packing_list_line.getQuantity()), 3) quantity = round( float(packing_list_line.getQuantity()), 3)
consumption_dict[start_date][hosting_reference][1][instance_reference][1][1] = quantity consumption_dict[start_date][instance_tree_reference][1][instance_reference][1][1] = quantity
elif packing_list_line.getResourceUid() == disk_resource_uid: elif packing_list_line.getResourceUid() == disk_resource_uid:
quantity = round( float(packing_list_line.getQuantity()), 3) quantity = round( float(packing_list_line.getQuantity()), 3)
consumption_dict[start_date][hosting_reference][1][instance_reference][1][2] = quantity consumption_dict[start_date][instance_tree_reference][1][instance_reference][1][2] = quantity
# Add CPU_LOAD consumption details # Add CPU_LOAD consumption details
for packing_list_line in getPackingListLineForResource(resource_uid_list): for packing_list_line in getPackingListLineForResource(resource_uid_list):
...@@ -132,12 +132,12 @@ i = 1 ...@@ -132,12 +132,12 @@ i = 1
# Sort on movement.start_date in catalog doesn't work ! # Sort on movement.start_date in catalog doesn't work !
for date in sorted(consumption_dict, reverse=True): for date in sorted(consumption_dict, reverse=True):
for hosting_key in sorted(consumption_dict[date]): for hosting_key in sorted(consumption_dict[date]):
hosting_title, instance_dict, hs_url = consumption_dict[date][hosting_key] instance_tree_title, instance_dict, hs_url = consumption_dict[date][hosting_key]
for instance_value_list in instance_dict.values(): for instance_value_list in instance_dict.values():
instance_title, values, instance_url, computer_title = instance_value_list instance_title, values, instance_url, computer_title = instance_value_list
line = newTempBase(portal, instance_url, uid="%s_%s" % (context.getUid(), i)) line = newTempBase(portal, instance_url, uid="%s_%s" % (context.getUid(), i))
line.edit( line.edit(
title=hosting_title, title=instance_tree_title,
start_date=date, start_date=date,
instance_title=instance_title, instance_title=instance_title,
cpu_load=values[0], cpu_load=values[0],
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>HostingSubscription_getResourceConsumptionDetailList</string> </value> <value> <string>InstanceTree_getResourceConsumptionDetailList</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -4,9 +4,9 @@ query_kw.update(query_kw['selection'].getParams()) ...@@ -4,9 +4,9 @@ query_kw.update(query_kw['selection'].getParams())
start_date = query_kw.pop('start_date', None) start_date = query_kw.pop('start_date', None)
stop_date = query_kw.pop('stop_date', None) stop_date = query_kw.pop('stop_date', None)
software_instance_uid = query_kw.pop('software_instance', None) software_instance_uid = query_kw.pop('software_instance', None)
hosting_subscription_uid = query_kw.pop('hosting_subscription_uid', None) instance_tree_uid = query_kw.pop('instance_tree_uid', None)
if not software_instance_uid and not hosting_subscription_uid: if not software_instance_uid and not instance_tree_uid:
return '' return ''
if start_date: if start_date:
...@@ -17,25 +17,25 @@ if stop_date: ...@@ -17,25 +17,25 @@ if stop_date:
if software_instance_uid and software_instance_uid != 'all': if software_instance_uid and software_instance_uid != 'all':
query_kw['aggregate_uid'] = software_instance_uid query_kw['aggregate_uid'] = software_instance_uid
elif hosting_subscription_uid and hosting_subscription_uid != 'all': elif instance_tree_uid and instance_tree_uid != 'all':
query_kw['aggregate_uid'] = hosting_subscription_uid query_kw['aggregate_uid'] = instance_tree_uid
elif context.getPortalType() == 'Person': elif context.getPortalType() == 'Person':
validation_state = query_kw.pop('hosting_validation_state', 'validated') validation_state = query_kw.pop('hosting_validation_state', 'validated')
hosting_uid_list = [] instance_tree_uid_list = []
for subscription in portal.portal_catalog( for subscription in portal.portal_catalog(
portal_type='Hosting Subscription', portal_type='Instance Tree',
validation_state=validation_state, validation_state=validation_state,
default_destination_section_uid=context.getUid()): default_destination_section_uid=context.getUid()):
if validation_state == 'validated' and subscription.getSlapState() == 'destroy_requested': if validation_state == 'validated' and subscription.getSlapState() == 'destroy_requested':
continue continue
if validation_state == 'archived' and subscription.getSlapState() != 'destroy_requested': if validation_state == 'archived' and subscription.getSlapState() != 'destroy_requested':
continue continue
hosting_uid_list.append(subscription.getUid()) instance_tree_uid_list.append(subscription.getUid())
if hosting_uid_list: if instance_tree_uid_list:
query_kw['aggregate_uid'] = hosting_uid_list query_kw['aggregate_uid'] = instance_tree_uid_list
else: else:
return '' return ''
elif context.getPortalType() in ['Software Instance', 'Hosting Subscription']: elif context.getPortalType() in ['Software Instance', 'Instance Tree']:
query_kw['aggregate_uid'] = context.getUid() query_kw['aggregate_uid'] = context.getUid()
else: else:
return '' return ''
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>HostingSubscription_getStatForResource</string> </value> <value> <string>InstanceTree_getStatForResource</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>HostingSubscription_viewConsumptionReport</string> </value> <value> <string>InstanceTree_viewConsumptionReport</string> </value>
</item> </item>
<item> <item>
<key> <string>method</string> </key> <key> <string>method</string> </key>
...@@ -107,7 +107,7 @@ ...@@ -107,7 +107,7 @@
</item> </item>
<item> <item>
<key> <string>name</string> </key> <key> <string>name</string> </key>
<value> <string>HostingSubscription_viewConsumptionReport</string> </value> <value> <string>InstanceTree_viewConsumptionReport</string> </value>
</item> </item>
<item> <item>
<key> <string>pt</string> </key> <key> <string>pt</string> </key>
...@@ -131,7 +131,7 @@ ...@@ -131,7 +131,7 @@
</item> </item>
<item> <item>
<key> <string>update_action</string> </key> <key> <string>update_action</string> </key>
<value> <string>HostingSubscription_viewConsumptionReport</string> </value> <value> <string>InstanceTree_viewConsumptionReport</string> </value>
</item> </item>
<item> <item>
<key> <string>update_action_title</string> </key> <key> <string>update_action_title</string> </key>
......
...@@ -401,7 +401,7 @@ ...@@ -401,7 +401,7 @@
<list> <list>
<tuple> <tuple>
<string>title</string> <string>title</string>
<string>Hosting Subscription</string> <string>Instance Tree</string>
</tuple> </tuple>
<tuple> <tuple>
<string>instance_title</string> <string>instance_title</string>
...@@ -568,7 +568,7 @@ ...@@ -568,7 +568,7 @@
</item> </item>
<item> <item>
<key> <string>selection_name</string> </key> <key> <string>selection_name</string> </key>
<value> <string>hosting_subscription_resource_used_search_selection</string> </value> <value> <string>instance_tree_resource_used_search_selection</string> </value>
</item> </item>
<item> <item>
<key> <string>sort</string> </key> <key> <string>sort</string> </key>
...@@ -588,15 +588,15 @@ ...@@ -588,15 +588,15 @@
<list> <list>
<tuple> <tuple>
<string>cpu_load</string> <string>cpu_load</string>
<string>HostingSubscription_getCPUStat</string> <string>InstanceTree_getCPUStat</string>
</tuple> </tuple>
<tuple> <tuple>
<string>memory_used</string> <string>memory_used</string>
<string>HostingSubscription_getMemoryStat</string> <string>InstanceTree_getMemoryStat</string>
</tuple> </tuple>
<tuple> <tuple>
<string>disk_used</string> <string>disk_used</string>
<string>HostingSubscription_getDiskStat</string> <string>InstanceTree_getDiskStat</string>
</tuple> </tuple>
</list> </list>
</value> </value>
...@@ -615,7 +615,7 @@ ...@@ -615,7 +615,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Hosting Subscription Resource list</string> </value> <value> <string>Instance Tree Resource list</string> </value>
</item> </item>
<item> <item>
<key> <string>untranslatable_columns</string> </key> <key> <string>untranslatable_columns</string> </key>
...@@ -656,7 +656,7 @@ ...@@ -656,7 +656,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>method_name</string> </key> <key> <string>method_name</string> </key>
<value> <string>HostingSubscription_getResourceConsumptionDetailList</string> </value> <value> <string>InstanceTree_getResourceConsumptionDetailList</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
<key> <string>right</string> </key> <key> <string>right</string> </key>
<value> <value>
<list> <list>
<string>your_hosting_subscription_uid</string> <string>your_instance_tree_uid</string>
<string>your_hosting_validation_state</string> <string>your_hosting_validation_state</string>
</list> </list>
</value> </value>
......
...@@ -401,7 +401,7 @@ ...@@ -401,7 +401,7 @@
<list> <list>
<tuple> <tuple>
<string>title</string> <string>title</string>
<string>Hosting Subscription</string> <string>Instance Tree</string>
</tuple> </tuple>
<tuple> <tuple>
<string>instance_title</string> <string>instance_title</string>
...@@ -598,15 +598,15 @@ ...@@ -598,15 +598,15 @@
<list> <list>
<tuple> <tuple>
<string>cpu_load</string> <string>cpu_load</string>
<string>HostingSubscription_getCPUStat</string> <string>InstanceTree_getCPUStat</string>
</tuple> </tuple>
<tuple> <tuple>
<string>memory_used</string> <string>memory_used</string>
<string>HostingSubscription_getMemoryStat</string> <string>InstanceTree_getMemoryStat</string>
</tuple> </tuple>
<tuple> <tuple>
<string>disk_used</string> <string>disk_used</string>
<string>HostingSubscription_getDiskStat</string> <string>InstanceTree_getDiskStat</string>
</tuple> </tuple>
</list> </list>
</value> </value>
...@@ -666,7 +666,7 @@ ...@@ -666,7 +666,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>method_name</string> </key> <key> <string>method_name</string> </key>
<value> <string>HostingSubscription_getResourceConsumptionDetailList</string> </value> <value> <string>InstanceTree_getResourceConsumptionDetailList</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
...@@ -679,7 +679,7 @@ ...@@ -679,7 +679,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>method_name</string> </key> <key> <string>method_name</string> </key>
<value> <string>HostingSubscription_getResourceConsumptionDetailList</string> </value> <value> <string>InstanceTree_getResourceConsumptionDetailList</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>your_hosting_subscription_uid</string> </value> <value> <string>your_instance_tree_uid</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
...@@ -245,7 +245,7 @@ ...@@ -245,7 +245,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Hosting Subscription</string> </value> <value> <string>Instance Tree</string> </value>
</item> </item>
<item> <item>
<key> <string>unicode</string> </key> <key> <string>unicode</string> </key>
...@@ -269,7 +269,7 @@ ...@@ -269,7 +269,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python: [(\'\', \'all\')] + [(i.getTitle(), i.getUid()) for i in context.portal_catalog(portal_type=\'Hosting Subscription\', default_destination_section_uid=context.getUid(), validation_state=container.REQUEST.get(\'validation_state\', \'validated\'))]</string> </value> <value> <string>python: [(\'\', \'all\')] + [(i.getTitle(), i.getUid()) for i in context.portal_catalog(portal_type=\'Instance Tree\', default_destination_section_uid=context.getUid(), validation_state=container.REQUEST.get(\'validation_state\', \'validated\'))]</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<tr> <tr>
<th><span>N&#x00b0;</span></th> <th><span>N&#x00b0;</span></th>
<th><span>Date</span></th> <th><span>Date</span></th>
<th><span>Hosting Subscription</span></th> <th><span>Instance Tree</span></th>
<th><span>Instance Name</span></th> <th><span>Instance Name</span></th>
<th><span>CPU Load</span></th> <th><span>CPU Load</span></th>
<th><span>Memory Used</span></th> <th><span>Memory Used</span></th>
......
...@@ -9,9 +9,9 @@ if not (title.startswith("kvm") or title.startswith("runner")): ...@@ -9,9 +9,9 @@ if not (title.startswith("kvm") or title.startswith("runner")):
# This instance is not a clone from resilience # This instance is not a clone from resilience
return None return None
hosting_subscription = context.getSpecialiseValue() instance_tree = context.getSpecialiseValue()
for instance in hosting_subscription.getSpecialiseRelatedValueList( for instance in instance_tree.getSpecialiseRelatedValueList(
portal_type="Software Instance"): portal_type="Software Instance"):
if instance.getTitle() in ["kvm0", "runner0"]: if instance.getTitle() in ["kvm0", "runner0"]:
return instance return instance
......
...@@ -626,7 +626,7 @@ ...@@ -626,7 +626,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>method_name</string> </key> <key> <string>method_name</string> </key>
<value> <string>HostingSubscription_getResourceConsumptionDetailList</string> </value> <value> <string>InstanceTree_getResourceConsumptionDetailList</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -3,10 +3,10 @@ if REQUEST is not None: ...@@ -3,10 +3,10 @@ if REQUEST is not None:
raise Unauthorized raise Unauthorized
software_instance = context software_instance = context
hosting_subscription = software_instance.getSpecialiseValue() instance_tree = software_instance.getSpecialiseValue()
if hosting_subscription is None: if instance_tree is None:
return return
person = hosting_subscription.getDestinationSectionValue(portal_type='Person') person = instance_tree.getDestinationSectionValue(portal_type='Person')
if person is None: if person is None:
return return
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>HostingSubscription_getNewsDict</string> </value> <value> <string>InstanceTree_getRuleReference</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -74,18 +74,18 @@ class TestSlapOSSalePackingListBuilder(SlapOSTestCaseMixin): ...@@ -74,18 +74,18 @@ class TestSlapOSSalePackingListBuilder(SlapOSTestCaseMixin):
delivery.getCategoryList()) delivery.getCategoryList())
def test(self): def test(self):
hosting_subscription = self.portal.hosting_subscription_module\ instance_tree = self.portal.instance_tree_module\
.template_hosting_subscription.Base_createCloneDocument(batch_mode=1) .template_instance_tree.Base_createCloneDocument(batch_mode=1)
applied_rule = self.portal.portal_simulation.newContent( applied_rule = self.portal.portal_simulation.newContent(
portal_type='Applied Rule', portal_type='Applied Rule',
causality=hosting_subscription.getRelativeUrl(), causality=instance_tree.getRelativeUrl(),
specialise='portal_rules/slapos_subscription_item_rule' specialise='portal_rules/slapos_subscription_item_rule'
) )
person = self.portal.person_module.template_member\ person = self.portal.person_module.template_member\
.Base_createCloneDocument(batch_mode=1) .Base_createCloneDocument(batch_mode=1)
simulation_movement_kw = dict( simulation_movement_kw = dict(
portal_type='Simulation Movement', portal_type='Simulation Movement',
aggregate=hosting_subscription.getRelativeUrl(), aggregate=instance_tree.getRelativeUrl(),
base_contribution=['base_amount/invoicing/discounted', base_contribution=['base_amount/invoicing/discounted',
'base_amount/invoicing/taxable'], 'base_amount/invoicing/taxable'],
causality=['business_process_module/slapos_aggregated_business_process' causality=['business_process_module/slapos_aggregated_business_process'
......
...@@ -11,17 +11,17 @@ from unittest import skip ...@@ -11,17 +11,17 @@ from unittest import skip
import transaction import transaction
class TestHostingSubscription(TestSlapOSConstraintMixin): class TestInstanceTree(TestSlapOSConstraintMixin):
# use decrator in order to avoid fixing consistency of new object # use decrator in order to avoid fixing consistency of new object
@WorkflowMethod.disable @WorkflowMethod.disable
def _createHostingSubscription(self): def _createInstanceTree(self):
self.subscription = self.portal.hosting_subscription_module.newContent( self.subscription = self.portal.instance_tree_module.newContent(
portal_type='Hosting Subscription') portal_type='Instance Tree')
def afterSetUp(self): def afterSetUp(self):
TestSlapOSConstraintMixin.afterSetUp(self) TestSlapOSConstraintMixin.afterSetUp(self)
self._createHostingSubscription() self._createInstanceTree()
def beforeTearDown(self): def beforeTearDown(self):
transaction.abort() transaction.abort()
...@@ -407,12 +407,12 @@ class TestSalePackingListLineConsumption(TestSlapOSConstraintMixin): ...@@ -407,12 +407,12 @@ class TestSalePackingListLineConsumption(TestSlapOSConstraintMixin):
delivery_line.edit(**{key: [aggregate_1]}) delivery_line.edit(**{key: [aggregate_1]})
self.assertFalse(message in self.getMessageList(delivery_line)) self.assertFalse(message in self.getMessageList(delivery_line))
def test_aggregate_hosting_subscription(self): def test_aggregate_instance_tree(self):
self._test_aggregate("There should be one Hosting Subscription related", self._test_aggregate("There should be one Instance Tree related",
self.portal.hosting_subscription_module.newContent( self.portal.instance_tree_module.newContent(
portal_type='Hosting Subscription').getRelativeUrl(), portal_type='Instance Tree').getRelativeUrl(),
self.portal.hosting_subscription_module.newContent( self.portal.instance_tree_module.newContent(
portal_type='Hosting Subscription').getRelativeUrl()) portal_type='Instance Tree').getRelativeUrl())
def test_aggregate_software_instance(self): def test_aggregate_software_instance(self):
self._test_aggregate("There should be one Software or Slave Instance related", self._test_aggregate("There should be one Software or Slave Instance related",
......
...@@ -9,8 +9,8 @@ class TestSlapOSAccountingInteractionWorkflow(SlapOSTestCaseMixin): ...@@ -9,8 +9,8 @@ class TestSlapOSAccountingInteractionWorkflow(SlapOSTestCaseMixin):
def beforeTearDown(self): def beforeTearDown(self):
transaction.abort() transaction.abort()
def _simulateHostingSubscription_calculateSubscriptionStartDate(self, date): def _simulateInstanceTree_calculateSubscriptionStartDate(self, date):
script_name = 'HostingSubscription_calculateSubscriptionStartDate' script_name = 'InstanceTree_calculateSubscriptionStartDate'
if script_name in self.portal.portal_skins.custom.objectIds(): if script_name in self.portal.portal_skins.custom.objectIds():
raise ValueError('Precondition failed: %s exists in custom' % script_name) raise ValueError('Precondition failed: %s exists in custom' % script_name)
createZODBPythonScript(self.portal.portal_skins.custom, createZODBPythonScript(self.portal.portal_skins.custom,
...@@ -21,17 +21,17 @@ class TestSlapOSAccountingInteractionWorkflow(SlapOSTestCaseMixin): ...@@ -21,17 +21,17 @@ class TestSlapOSAccountingInteractionWorkflow(SlapOSTestCaseMixin):
return DateTime('%s') """ % date.ISO()) return DateTime('%s') """ % date.ISO())
transaction.commit() transaction.commit()
def _dropHostingSubscription_calculateSubscriptionStartDate(self): def _dropInstanceTree_calculateSubscriptionStartDate(self):
script_name = 'HostingSubscription_calculateSubscriptionStartDate' script_name = 'InstanceTree_calculateSubscriptionStartDate'
if script_name in self.portal.portal_skins.custom.objectIds(): if script_name in self.portal.portal_skins.custom.objectIds():
self.portal.portal_skins.custom.manage_delObjects(script_name) self.portal.portal_skins.custom.manage_delObjects(script_name)
transaction.commit() transaction.commit()
def test_HostingSubscription_fixConsistency(self, def test_InstanceTree_fixConsistency(self,
date=DateTime('2012/01/15'), day=15): date=DateTime('2012/01/15'), day=15):
new_id = self.generateNewId() new_id = self.generateNewId()
item = self.portal.hosting_subscription_module.newContent( item = self.portal.instance_tree_module.newContent(
portal_type='Hosting Subscription', portal_type='Instance Tree',
title="Subscription %s" % new_id, title="Subscription %s" % new_id,
reference="TESTSUB-%s" % new_id, reference="TESTSUB-%s" % new_id,
periodicity_hour_list=None, periodicity_hour_list=None,
...@@ -43,48 +43,48 @@ return DateTime('%s') """ % date.ISO()) ...@@ -43,48 +43,48 @@ return DateTime('%s') """ % date.ISO())
self.assertEqual(item.getPeriodicityMinute(), None) self.assertEqual(item.getPeriodicityMinute(), None)
self.assertEqual(item.getPeriodicityMonthDay(), None) self.assertEqual(item.getPeriodicityMonthDay(), None)
self._simulateHostingSubscription_calculateSubscriptionStartDate(date) self._simulateInstanceTree_calculateSubscriptionStartDate(date)
try: try:
item.fixConsistency() item.fixConsistency()
finally: finally:
self._dropHostingSubscription_calculateSubscriptionStartDate() self._dropInstanceTree_calculateSubscriptionStartDate()
self.assertEqual(item.getPeriodicityHourList(), [0]) self.assertEqual(item.getPeriodicityHourList(), [0])
self.assertEqual(item.getPeriodicityMinuteList(), [0]) self.assertEqual(item.getPeriodicityMinuteList(), [0])
self.assertEqual(item.getPeriodicityMonthDay(), day) self.assertEqual(item.getPeriodicityMonthDay(), day)
def test_HostingSubscription_fixConsistency_today_after_28(self): def test_InstanceTree_fixConsistency_today_after_28(self):
self.test_HostingSubscription_fixConsistency(DateTime('2012/01/29'), 28) self.test_InstanceTree_fixConsistency(DateTime('2012/01/29'), 28)
def test_HostingSubscription_manageAfter(self): def test_InstanceTree_manageAfter(self):
class DummyTestException(Exception): class DummyTestException(Exception):
pass pass
def verify_fixConsistency_call(self): def verify_fixConsistency_call(self):
# Check that fixConsistency is called on hosting subscription # Check that fixConsistency is called on instance tree
if self.getRelativeUrl().startswith('hosting_subscription_module/'): if self.getRelativeUrl().startswith('instance_tree_module/'):
raise DummyTestException raise DummyTestException
else: else:
return self.fixConsistency_call() return self.fixConsistency_call()
# Replace serialize by a dummy method # Replace serialize by a dummy method
HostingSubscriptionClass = self.portal.portal_types.getPortalTypeClass( InstanceTreeClass = self.portal.portal_types.getPortalTypeClass(
'Hosting Subscription') 'Instance Tree')
HostingSubscriptionClass.fixConsistency_call = HostingSubscriptionClass.\ InstanceTreeClass.fixConsistency_call = InstanceTreeClass.\
fixConsistency fixConsistency
HostingSubscriptionClass.fixConsistency = verify_fixConsistency_call InstanceTreeClass.fixConsistency = verify_fixConsistency_call
try: try:
# manage_afterAdd # manage_afterAdd
self.assertRaises( self.assertRaises(
DummyTestException, DummyTestException,
self.portal.hosting_subscription_module.newContent, self.portal.instance_tree_module.newContent,
portal_type='Hosting Subscription') portal_type='Instance Tree')
# manage_afterClone # manage_afterClone
self.assertRaises( self.assertRaises(
DummyTestException, DummyTestException,
self.portal.hosting_subscription_module.\ self.portal.instance_tree_module.\
template_hosting_subscription.Base_createCloneDocument, template_instance_tree.Base_createCloneDocument,
batch_mode=1) batch_mode=1)
finally: finally:
self.portal.portal_types.resetDynamicDocumentsOnceAtTransactionBoundary() self.portal.portal_types.resetDynamicDocumentsOnceAtTransactionBoundary()
...@@ -183,10 +183,10 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by D ...@@ -183,10 +183,10 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by D
self._test_calculate(new_id, newContent, portal_type=portal_type, self._test_calculate(new_id, newContent, portal_type=portal_type,
start_date='2011/01/01') start_date='2011/01/01')
def test_HostingSubscription_changePromise(self): def test_InstanceTree_changePromise(self):
new_id = self.generateNewId() new_id = self.generateNewId()
subscription = self.portal.hosting_subscription_module.newContent( subscription = self.portal.instance_tree_module.newContent(
portal_type='Hosting Subscription', portal_type='Instance Tree',
title="Subscription %s" % new_id, title="Subscription %s" % new_id,
reference="TESTSUB-%s" % new_id, reference="TESTSUB-%s" % new_id,
) )
...@@ -208,10 +208,10 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by D ...@@ -208,10 +208,10 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by D
subscription.requestDestroy(**request_kw) subscription.requestDestroy(**request_kw)
self.assertEqual(subscription.getCausalityState(), 'diverged') self.assertEqual(subscription.getCausalityState(), 'diverged')
def test_HostingSubscription_changePromiseInDivergedState(self): def test_InstanceTree_changePromiseInDivergedState(self):
new_id = self.generateNewId() new_id = self.generateNewId()
subscription = self.portal.hosting_subscription_module.newContent( subscription = self.portal.instance_tree_module.newContent(
portal_type='Hosting Subscription', portal_type='Instance Tree',
title="Subscription %s" % new_id, title="Subscription %s" % new_id,
reference="TESTSUB-%s" % new_id, reference="TESTSUB-%s" % new_id,
) )
......
...@@ -38,8 +38,8 @@ class TestDefaultInvoiceTransactionRule(SlapOSTestCaseMixin): ...@@ -38,8 +38,8 @@ class TestDefaultInvoiceTransactionRule(SlapOSTestCaseMixin):
.Base_createCloneDocument(batch_mode=1) .Base_createCloneDocument(batch_mode=1)
destination = self.portal.person_module.template_member\ destination = self.portal.person_module.template_member\
.Base_createCloneDocument(batch_mode=1) .Base_createCloneDocument(batch_mode=1)
aggregate = self.portal.hosting_subscription_module\ aggregate = self.portal.instance_tree_module\
.template_hosting_subscription.Base_createCloneDocument(batch_mode=1) .template_instance_tree.Base_createCloneDocument(batch_mode=1)
resource = self.portal.service_module.slapos_instance_subscription resource = self.portal.service_module.slapos_instance_subscription
start_date = DateTime('2011/02/16') start_date = DateTime('2011/02/16')
stop_date = DateTime('2011/03/16') stop_date = DateTime('2011/03/16')
...@@ -244,8 +244,8 @@ class TestDefaultInvoicingRule(SlapOSTestCaseMixin): ...@@ -244,8 +244,8 @@ class TestDefaultInvoicingRule(SlapOSTestCaseMixin):
.Base_createCloneDocument(batch_mode=1) .Base_createCloneDocument(batch_mode=1)
destination = self.portal.person_module.template_member\ destination = self.portal.person_module.template_member\
.Base_createCloneDocument(batch_mode=1) .Base_createCloneDocument(batch_mode=1)
aggregate = self.portal.hosting_subscription_module\ aggregate = self.portal.instance_tree_module\
.template_hosting_subscription.Base_createCloneDocument(batch_mode=1) .template_instance_tree.Base_createCloneDocument(batch_mode=1)
resource = self.portal.service_module.slapos_instance_subscription resource = self.portal.service_module.slapos_instance_subscription
start_date = DateTime('2011/02/16') start_date = DateTime('2011/02/16')
stop_date = DateTime('2011/03/16') stop_date = DateTime('2011/03/16')
...@@ -417,12 +417,12 @@ class TestDefaultPaymentRule(SlapOSTestCaseMixin): ...@@ -417,12 +417,12 @@ class TestDefaultPaymentRule(SlapOSTestCaseMixin):
SimulationMovement.getSimulationState = SimulationMovement\ SimulationMovement.getSimulationState = SimulationMovement\
.original_getSimulationState .original_getSimulationState
class TestHostingSubscriptionSimulation(SlapOSTestCaseMixin): class TestInstanceTreeSimulation(SlapOSTestCaseMixin):
def _prepare(self): def _prepare(self):
person = self.portal.person_module.template_member\ person = self.portal.person_module.template_member\
.Base_createCloneDocument(batch_mode=1) .Base_createCloneDocument(batch_mode=1)
self.subscription = self.portal.hosting_subscription_module\ self.subscription = self.portal.instance_tree_module\
.template_hosting_subscription.Base_createCloneDocument(batch_mode=1) .template_instance_tree.Base_createCloneDocument(batch_mode=1)
self.initial_date = DateTime('2011/02/16') self.initial_date = DateTime('2011/02/16')
stop_date = DateTime('2011/04/16') stop_date = DateTime('2011/04/16')
self.subscription.edit( self.subscription.edit(
...@@ -677,8 +677,8 @@ class TestDefaultTradeModelRule(SlapOSTestCaseMixin): ...@@ -677,8 +677,8 @@ class TestDefaultTradeModelRule(SlapOSTestCaseMixin):
.Base_createCloneDocument(batch_mode=1) .Base_createCloneDocument(batch_mode=1)
destination = self.portal.person_module.template_member\ destination = self.portal.person_module.template_member\
.Base_createCloneDocument(batch_mode=1) .Base_createCloneDocument(batch_mode=1)
aggregate = self.portal.hosting_subscription_module\ aggregate = self.portal.instance_tree_module\
.template_hosting_subscription.Base_createCloneDocument(batch_mode=1) .template_instance_tree.Base_createCloneDocument(batch_mode=1)
resource = self.portal.service_module.slapos_instance_subscription resource = self.portal.service_module.slapos_instance_subscription
start_date = DateTime('2011/02/16') start_date = DateTime('2011/02/16')
stop_date = DateTime('2011/03/16') stop_date = DateTime('2011/03/16')
...@@ -801,8 +801,8 @@ class TestDefaultDeliveryRule(SlapOSTestCaseMixin): ...@@ -801,8 +801,8 @@ class TestDefaultDeliveryRule(SlapOSTestCaseMixin):
use='trade/sale', use='trade/sale',
quantity_unit='unit/piece', quantity_unit='unit/piece',
aggregate_list=[ aggregate_list=[
self.portal.hosting_subscription_module.newContent( self.portal.instance_tree_module.newContent(
portal_type='Hosting Subscription').getRelativeUrl(), portal_type='Instance Tree').getRelativeUrl(),
self.portal.service_module.newContent( self.portal.service_module.newContent(
portal_type='Service').getRelativeUrl() portal_type='Service').getRelativeUrl()
], ],
...@@ -889,8 +889,8 @@ class TestDefaultDeliveryRuleConsumption(SlapOSTestCaseMixin): ...@@ -889,8 +889,8 @@ class TestDefaultDeliveryRuleConsumption(SlapOSTestCaseMixin):
use='trade/sale', use='trade/sale',
quantity_unit='unit/piece', quantity_unit='unit/piece',
aggregate_list=[ aggregate_list=[
self.portal.hosting_subscription_module.newContent( self.portal.instance_tree_module.newContent(
portal_type='Hosting Subscription').getRelativeUrl(), portal_type='Instance Tree').getRelativeUrl(),
self.portal.service_module.newContent( self.portal.service_module.newContent(
portal_type='Service').getRelativeUrl() portal_type='Service').getRelativeUrl()
], ],
......
...@@ -12,10 +12,10 @@ import time ...@@ -12,10 +12,10 @@ import time
class TestSlapOSAccounting(SlapOSTestCaseMixin): class TestSlapOSAccounting(SlapOSTestCaseMixin):
def createHostingSubscription(self): def createInstanceTree(self):
new_id = self.generateNewId() new_id = self.generateNewId()
return self.portal.hosting_subscription_module.newContent( return self.portal.instance_tree_module.newContent(
portal_type='Hosting Subscription', portal_type='Instance Tree',
title="Subscription %s" % new_id, title="Subscription %s" % new_id,
reference="TESTHS-%s" % new_id, reference="TESTHS-%s" % new_id,
) )
...@@ -30,22 +30,22 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin): ...@@ -30,22 +30,22 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
@withAbort @withAbort
def test_HS_calculateSubscriptionStartDate_REQUEST_disallowed(self): def test_HS_calculateSubscriptionStartDate_REQUEST_disallowed(self):
item = self.createHostingSubscription() item = self.createInstanceTree()
self.assertRaises( self.assertRaises(
Unauthorized, Unauthorized,
item.HostingSubscription_calculateSubscriptionStartDate, item.InstanceTree_calculateSubscriptionStartDate,
REQUEST={}) REQUEST={})
@withAbort @withAbort
def test_HS_calculateSubscriptionStartDate_noWorkflow(self): def test_HS_calculateSubscriptionStartDate_noWorkflow(self):
item = self.createHostingSubscription() item = self.createInstanceTree()
item.workflow_history['instance_slap_interface_workflow'] = [] item.workflow_history['instance_slap_interface_workflow'] = []
date = item.HostingSubscription_calculateSubscriptionStartDate() date = item.InstanceTree_calculateSubscriptionStartDate()
self.assertEqual(date, item.getCreationDate().earliestTime()) self.assertEqual(date, item.getCreationDate().earliestTime())
@withAbort @withAbort
def test_HS_calculateSubscriptionStartDate_withRequest(self): def test_HS_calculateSubscriptionStartDate_withRequest(self):
item = self.createHostingSubscription() item = self.createInstanceTree()
item.workflow_history['instance_slap_interface_workflow'] = [{ item.workflow_history['instance_slap_interface_workflow'] = [{
'comment':'Directly request the instance', 'comment':'Directly request the instance',
'error_message': '', 'error_message': '',
...@@ -54,12 +54,12 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin): ...@@ -54,12 +54,12 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
'time': DateTime('2012/11/15 11:11'), 'time': DateTime('2012/11/15 11:11'),
'action': 'request_instance' 'action': 'request_instance'
}] }]
date = item.HostingSubscription_calculateSubscriptionStartDate() date = item.InstanceTree_calculateSubscriptionStartDate()
self.assertEqual(date, DateTime('2012/11/15')) self.assertEqual(date, DateTime('2012/11/15'))
@withAbort @withAbort
def test_HS_calculateSubscriptionStartDate_withRequestEndOfMonth(self): def test_HS_calculateSubscriptionStartDate_withRequestEndOfMonth(self):
item = self.createHostingSubscription() item = self.createInstanceTree()
item.workflow_history['instance_slap_interface_workflow'] = [{ item.workflow_history['instance_slap_interface_workflow'] = [{
'comment':'Directly request the instance', 'comment':'Directly request the instance',
'error_message': '', 'error_message': '',
...@@ -68,12 +68,12 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin): ...@@ -68,12 +68,12 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
'time': DateTime('2012/11/30 11:11'), 'time': DateTime('2012/11/30 11:11'),
'action': 'request_instance' 'action': 'request_instance'
}] }]
date = item.HostingSubscription_calculateSubscriptionStartDate() date = item.InstanceTree_calculateSubscriptionStartDate()
self.assertEqual(date, DateTime('2012/11/30')) self.assertEqual(date, DateTime('2012/11/30'))
@withAbort @withAbort
def test_HS_calculateSubscriptionStartDate_withRequestAfterDestroy(self): def test_HS_calculateSubscriptionStartDate_withRequestAfterDestroy(self):
item = self.createHostingSubscription() item = self.createInstanceTree()
destroy_date = DateTime('2012/10/30 11:11') destroy_date = DateTime('2012/10/30 11:11')
request_date = DateTime('2012/11/30 11:11') request_date = DateTime('2012/11/30 11:11')
item.workflow_history['instance_slap_interface_workflow'] = [] item.workflow_history['instance_slap_interface_workflow'] = []
...@@ -93,20 +93,20 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin): ...@@ -93,20 +93,20 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
'time': request_date, 'time': request_date,
'action': 'request_instance' 'action': 'request_instance'
}) })
date = item.HostingSubscription_calculateSubscriptionStartDate() date = item.InstanceTree_calculateSubscriptionStartDate()
self.assertEqual(date, DateTime('2012/10/30')) self.assertEqual(date, DateTime('2012/10/30'))
@withAbort @withAbort
def test_HS_calculateSubscriptionStopDate_REQUEST_disallowed(self): def test_HS_calculateSubscriptionStopDate_REQUEST_disallowed(self):
item = self.createHostingSubscription() item = self.createInstanceTree()
self.assertRaises( self.assertRaises(
Unauthorized, Unauthorized,
item.HostingSubscription_calculateSubscriptionStopDate, item.InstanceTree_calculateSubscriptionStopDate,
REQUEST={}) REQUEST={})
@withAbort @withAbort
def test_HS_calculateSubscriptionStopDate_withDestroy(self): def test_HS_calculateSubscriptionStopDate_withDestroy(self):
item = self.createHostingSubscription() item = self.createInstanceTree()
destroy_date = DateTime('2012/10/30') destroy_date = DateTime('2012/10/30')
item.workflow_history['instance_slap_interface_workflow'].append({ item.workflow_history['instance_slap_interface_workflow'].append({
'comment':'Directly destroy', 'comment':'Directly destroy',
...@@ -116,14 +116,14 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin): ...@@ -116,14 +116,14 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
'time': destroy_date, 'time': destroy_date,
'action': 'request_destroy' 'action': 'request_destroy'
}) })
date = item.HostingSubscription_calculateSubscriptionStopDate() date = item.InstanceTree_calculateSubscriptionStopDate()
self.assertEqual(date, DateTime('2012/10/31')) self.assertEqual(date, DateTime('2012/10/31'))
@withAbort @withAbort
def test_HS_calculateSubscriptionStopDate_noDestroy(self): def test_HS_calculateSubscriptionStopDate_noDestroy(self):
item = self.createHostingSubscription() item = self.createInstanceTree()
item.workflow_history['instance_slap_interface_workflow'] = [] item.workflow_history['instance_slap_interface_workflow'] = []
date = item.HostingSubscription_calculateSubscriptionStopDate() date = item.InstanceTree_calculateSubscriptionStopDate()
self.assertEqual(date, None) self.assertEqual(date, None)
def test_OpenSaleOrder_reindexIfIndexedBeforeLine_no_line(self): def test_OpenSaleOrder_reindexIfIndexedBeforeLine_no_line(self):
......
...@@ -40,8 +40,8 @@ class TestSlapOSSoftwareInstance_requestValidationPayment(SlapOSTestCaseMixinWit ...@@ -40,8 +40,8 @@ class TestSlapOSSoftwareInstance_requestValidationPayment(SlapOSTestCaseMixinWit
title="Person %s" % new_id, title="Person %s" % new_id,
reference="TESTPERS-%s" % new_id, reference="TESTPERS-%s" % new_id,
) )
subscription = self.portal.hosting_subscription_module.newContent( subscription = self.portal.instance_tree_module.newContent(
portal_type='Hosting Subscription', portal_type='Instance Tree',
title="Subscription %s" % new_id, title="Subscription %s" % new_id,
reference="TESTSUB-%s" % new_id, reference="TESTSUB-%s" % new_id,
destination_section_value=person, destination_section_value=person,
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>HostingSubscription_afterAddClone</string> </value> <value> <string>InstanceTree_afterAddClone</string> </value>
</item> </item>
<item> <item>
<key> <string>method_id</string> </key> <key> <string>method_id</string> </key>
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
<key> <string>portal_type_filter</string> </key> <key> <string>portal_type_filter</string> </key>
<value> <value>
<list> <list>
<string>Hosting Subscription</string> <string>Instance Tree</string>
</list> </list>
</value> </value>
</item> </item>
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>HostingSubscription_changePromiseState</string> </value> <value> <string>InstanceTree_changePromiseState</string> </value>
</item> </item>
<item> <item>
<key> <string>method_id</string> </key> <key> <string>method_id</string> </key>
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>HostingSubscription_fixConsistency</string> </value> <value> <string>InstanceTree_fixConsistency</string> </value>
</item> </item>
<item> <item>
<key> <string>method_id</string> </key> <key> <string>method_id</string> </key>
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
<key> <string>portal_type_filter</string> </key> <key> <string>portal_type_filter</string> </key>
<value> <value>
<list> <list>
<string>Hosting Subscription</string> <string>Instance Tree</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
<key> <string>script_name</string> </key> <key> <string>script_name</string> </key>
<value> <value>
<list> <list>
<string>HostingSubscription_fixPeriodicity</string> <string>InstanceTree_fixPeriodicity</string>
</list> </list>
</value> </value>
</item> </item>
......
from erp5.component.module.DateUtils import addToDate, getClosestDate from erp5.component.module.DateUtils import addToDate, getClosestDate
hosting_subscription = state_change['object'] instance_tree = state_change['object']
edit_kw = {} edit_kw = {}
if hosting_subscription.getPeriodicityHour() is None: if instance_tree.getPeriodicityHour() is None:
edit_kw['periodicity_hour_list'] = [0] edit_kw['periodicity_hour_list'] = [0]
if hosting_subscription.getPeriodicityMinute() is None: if instance_tree.getPeriodicityMinute() is None:
edit_kw['periodicity_minute_list'] = [0] edit_kw['periodicity_minute_list'] = [0]
if hosting_subscription.getPeriodicityMonthDay() is None: if instance_tree.getPeriodicityMonthDay() is None:
start_date = hosting_subscription.HostingSubscription_calculateSubscriptionStartDate() start_date = instance_tree.InstanceTree_calculateSubscriptionStartDate()
start_date = getClosestDate(target_date=start_date, precision='day') start_date = getClosestDate(target_date=start_date, precision='day')
while start_date.day() >= 29: while start_date.day() >= 29:
start_date = addToDate(start_date, to_add={'day': -1}) start_date = addToDate(start_date, to_add={'day': -1})
edit_kw['periodicity_month_day_list'] = [start_date.day()] edit_kw['periodicity_month_day_list'] = [start_date.day()]
if edit_kw: if edit_kw:
hosting_subscription.edit(**edit_kw) instance_tree.edit(**edit_kw)
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>HostingSubscription_fixPeriodicity</string> </value> <value> <string>InstanceTree_fixPeriodicity</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -5,8 +5,8 @@ Computer Consumption TioXML File | download ...@@ -5,8 +5,8 @@ Computer Consumption TioXML File | download
Computer Consumption TioXML File | view Computer Consumption TioXML File | view
Computer | jump_to_consumption_report_view Computer | jump_to_consumption_report_view
Consumption Document Module | view Consumption Document Module | view
Hosting Subscription | jump_to_related_open_order_line Instance Tree | jump_to_related_open_order_line
Hosting Subscription | periodicity Instance Tree | periodicity
Payment Transaction | related_payzen_event Payment Transaction | related_payzen_event
Person | create_new_cloud_contract Person | create_new_cloud_contract
Person | jump_to_cloud_contract Person | jump_to_cloud_contract
......
...@@ -34,7 +34,7 @@ portal_alarms/slapos_deliver_started_aggregated_sale_packing_list ...@@ -34,7 +34,7 @@ portal_alarms/slapos_deliver_started_aggregated_sale_packing_list
portal_alarms/slapos_manage_building_calculating_delivery portal_alarms/slapos_manage_building_calculating_delivery
portal_alarms/slapos_reindex_open_sale_order portal_alarms/slapos_reindex_open_sale_order
portal_alarms/slapos_remove_bogus_delivery_link portal_alarms/slapos_remove_bogus_delivery_link
portal_alarms/slapos_request_update_hosting_subscription_open_sale_order portal_alarms/slapos_request_update_instance_tree_open_sale_order
portal_alarms/slapos_start_confirmed_aggregated_sale_packing_list portal_alarms/slapos_start_confirmed_aggregated_sale_packing_list
portal_alarms/slapos_start_confirmed_aggregated_subscription_sale_packing_list portal_alarms/slapos_start_confirmed_aggregated_subscription_sale_packing_list
portal_alarms/slapos_stop_confirmed_aggregated_sale_invoice_transaction portal_alarms/slapos_stop_confirmed_aggregated_sale_invoice_transaction
......
Cloud Contract Line | SlapOSCloudContractLineAccounting Cloud Contract Line | SlapOSCloudContractLineAccounting
Cloud Contract | SlapOSCloudContractAccounting Cloud Contract | SlapOSCloudContractAccounting
Computer Consumption TioXML File | SortIndex Computer Consumption TioXML File | SortIndex
Hosting Subscription | SlapOSAccountingHostingSubscriptionConstraint Instance Tree | SlapOSAccountingInstanceTreeConstraint
Sale Invoice Transaction | SlapOSAccountingSaleInvoiceTransactionConstraint Sale Invoice Transaction | SlapOSAccountingSaleInvoiceTransactionConstraint
Sale Packing List Line | SlapOSAccountingSalePackingListLineConstraint Sale Packing List Line | SlapOSAccountingSalePackingListLineConstraint
Sale Packing List | SlapOSAccountingSalePackingListConstraint Sale Packing List | SlapOSAccountingSalePackingListConstraint
......
...@@ -4,8 +4,8 @@ Cloud Contract | item_workflow ...@@ -4,8 +4,8 @@ Cloud Contract | item_workflow
Computer Consumption TioXML File | document_conversion_interaction_workflow Computer Consumption TioXML File | document_conversion_interaction_workflow
Computer Consumption TioXML File | document_publication_workflow Computer Consumption TioXML File | document_publication_workflow
Computer Consumption TioXML File | edit_workflow Computer Consumption TioXML File | edit_workflow
Hosting Subscription | slapos_accounting_interaction_workflow Instance Tree | slapos_accounting_interaction_workflow
Hosting Subscription | slapos_api_invoicing_workflow Instance Tree | slapos_api_invoicing_workflow
Sale Invoice Transaction | slapos_accounting_interaction_workflow Sale Invoice Transaction | slapos_accounting_interaction_workflow
Sale Packing List | slapos_accounting_interaction_workflow Sale Packing List | slapos_accounting_interaction_workflow
Subscription Item Root Simulation Rule | edit_workflow Subscription Item Root Simulation Rule | edit_workflow
......
InstanceAccountingSynchronisation InstanceAccountingSynchronisation
SlapOSAccountingHostingSubscriptionConstraint SlapOSAccountingInstanceTreeConstraint
SlapOSAccountingSaleInvoiceTransactionConstraint SlapOSAccountingSaleInvoiceTransactionConstraint
SlapOSAccountingSalePackingListConstraint SlapOSAccountingSalePackingListConstraint
SlapOSAccountingSalePackingListLineConstraint SlapOSAccountingSalePackingListLineConstraint
......
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Hosting Subscription</string> </value> <value> <string>Instance Tree</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_list</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_list</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>view</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>1.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>View</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/InstanceTreeModule_viewInstanceTreeList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>string:${object_url}/HostingSubscription_createUpgradeDecision</string> </value> <value> <string>string:${object_url}/InstanceTree_createUpgradeDecision</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>string:${object_url}/HostingSubscription_requestStart</string> </value> <value> <string>string:${object_url}/InstanceTree_requestStart</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>string:${object_url}/HostingSubscription_requestStop</string> </value> <value> <string>string:${object_url}/InstanceTree_requestStop</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_view</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_view</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>view</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>1.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>View</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/InstanceTree_view</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>string:${object_url}/HostingSubscription_viewRequestDestroyDialog</string> </value> <value> <string>string:${object_url}/InstanceTree_viewRequestDestroyDialog</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>jump_to_hosting_subscription</string> </value> <value> <string>jump_to_instance_tree</string> </value>
</item> </item>
<item> <item>
<key> <string>permissions</string> </key> <key> <string>permissions</string> </key>
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Hosting Subscriptions</string> </value> <value> <string>Instance Trees</string> </value>
</item> </item>
<item> <item>
<key> <string>visible</string> </key> <key> <string>visible</string> </key>
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
string:${object_url}/Base_jumpToRelatedObject?base_category=destination_section&portal_type=Hosting+Subscription string:${object_url}/Base_jumpToRelatedObject?base_category=destination_section&portal_type=Instance+Tree
]]></string> </value> ]]></string> </value>
</item> </item>
...@@ -92,7 +92,7 @@ string:${object_url}/Base_jumpToRelatedObject?base_category=destination_section& ...@@ -92,7 +92,7 @@ string:${object_url}/Base_jumpToRelatedObject?base_category=destination_section&
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>python: portal.Base_checkPermission(\'hosting_subscription_module\', \'View\')</string> </value> <value> <string>python: portal.Base_checkPermission(\'instance_tree_module\', \'View\')</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>jump_to_hosting_subscription</string> </value> <value> <string>jump_to_instance_tree</string> </value>
</item> </item>
<item> <item>
<key> <string>permissions</string> </key> <key> <string>permissions</string> </key>
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Hosting Subscription</string> </value> <value> <string>Instance Tree</string> </value>
</item> </item>
<item> <item>
<key> <string>visible</string> </key> <key> <string>visible</string> </key>
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
string:${object_url}/Base_jumpToRelatedObject?base_category=specialise&portal_type:list=Hosting+Subscription string:${object_url}/Base_jumpToRelatedObject?base_category=specialise&portal_type:list=Instance+Tree
]]></string> </value> ]]></string> </value>
</item> </item>
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>jump_to_hosting_subscription</string> </value> <value> <string>jump_to_instance_tree</string> </value>
</item> </item>
<item> <item>
<key> <string>permissions</string> </key> <key> <string>permissions</string> </key>
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Hosting Subscription</string> </value> <value> <string>Instance Tree</string> </value>
</item> </item>
<item> <item>
<key> <string>visible</string> </key> <key> <string>visible</string> </key>
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
string:${object_url}/Base_jumpToRelatedObject?base_category=specialise&portal_type:list=Hosting+Subscription string:${object_url}/Base_jumpToRelatedObject?base_category=specialise&portal_type:list=Instance+Tree
]]></string> </value> ]]></string> </value>
</item> </item>
......
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
string:${object_url}/Base_jumpToRelatedObject?base_category=successor&portal_type:list=Software+Instance&portal_type:list=Hosting+Subscription string:${object_url}/Base_jumpToRelatedObject?base_category=successor&portal_type:list=Software+Instance&portal_type:list=Instance+Tree
]]></string> </value> ]]></string> </value>
</item> </item>
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
</item> </item>
<item> <item>
<key> <string>expression</string> </key> <key> <string>expression</string> </key>
<value> <string>python: context.getPortalType() in (\'Email\', \'Fax\', \'Telephone\', \'Software Release\', \'Software Installation\', \'Software Instance\', \'Hosting Subscription\')</string> </value> <value> <string>python: context.getPortalType() in (\'Email\', \'Fax\', \'Telephone\', \'Software Release\', \'Software Installation\', \'Software Instance\', \'Instance Tree\')</string> </value>
</item> </item>
<item> <item>
<key> <string>expression_cache_key</string> </key> <key> <string>expression_cache_key</string> </key>
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
</item> </item>
<item> <item>
<key> <string>expression</string> </key> <key> <string>expression</string> </key>
<value> <string>python: context.getPortalType() in [\'Software Instance\', \'Slave Instance\', \'Hosting Subscription\', \'Software Installation\']</string> </value> <value> <string>python: context.getPortalType() in [\'Software Instance\', \'Slave Instance\', \'Instance Tree\', \'Software Installation\']</string> </value>
</item> </item>
<item> <item>
<key> <string>expression_cache_key</string> </key> <key> <string>expression_cache_key</string> </key>
......
<dtml-let email_list="[]"> <dtml-let email_list="[]">
<dtml-in prefix="loop" expr="_.range(_.len(uid))"> <dtml-in prefix="loop" expr="_.range(_.len(uid))">
<dtml-if expr="getPortalType[loop_item] in ['Email', 'Software Release', 'Software Installation', 'Software Instance', 'Hosting Subscription']"> <dtml-if expr="getPortalType[loop_item] in ['Email', 'Software Release', 'Software Installation', 'Software Instance', 'Instance Tree']">
<dtml-call expr="email_list.append(loop_item)"> <dtml-call expr="email_list.append(loop_item)">
</dtml-if> </dtml-if>
</dtml-in> </dtml-in>
......
...@@ -18,7 +18,7 @@ getPortalType</string> </value> ...@@ -18,7 +18,7 @@ getPortalType</string> </value>
</item> </item>
<item> <item>
<key> <string>expression</string> </key> <key> <string>expression</string> </key>
<value> <string>python: context.getPortalType() in (\'Email\', \'Fax\', \'Telephone\', \'Software Release\', \'Software Installation\', \'Software Instance\', \'Hosting Subscription\')</string> </value> <value> <string>python: context.getPortalType() in (\'Email\', \'Fax\', \'Telephone\', \'Software Release\', \'Software Installation\', \'Software Instance\', \'Instance Tree\')</string> </value>
</item> </item>
<item> <item>
<key> <string>expression_cache_key</string> </key> <key> <string>expression_cache_key</string> </key>
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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