Commit 0d87e7ea authored by Romain Courteaud's avatar Romain Courteaud

slapos_*: rename Hosting Subscription to Instance Tree

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