Commit 1a2b4552 authored by Romain Courteaud's avatar Romain Courteaud

Drop SoftwareInstance_getInstancePackingListLine.

parent e0ba5534
...@@ -53,11 +53,11 @@ ...@@ -53,11 +53,11 @@
<value> <string>if context.getPortalType() == \'Sale Order Line\':\n <value> <string>if context.getPortalType() == \'Sale Order Line\':\n
delivery_line = context\n delivery_line = context\n
else:\n else:\n
delivery_line = context.SoftwareInstance_getInstancePackingListLine(portal_type=["Sale Order Line", "Sale Packing List Line"])\n delivery = context.getCausalityValue(portal_type=["Sale Order", "Sale Packing List"])\n
delivery_line = context.contentValues(portal_type=["Sale Order Line", "Sale Packing List Line"])[0]\n
\n \n
if delivery_line is not None:\n software_release = delivery_line.getAggregateValue(portal_type=\'Software Release\')\n
software_release = delivery_line.getAggregateValue(portal_type=\'Software Release\')\n if software_release is not None:\n
if software_release is not None:\n
software_product = software_release.getAggregateValue()\n software_product = software_release.getAggregateValue()\n
if software_product is not None:\n if software_product is not None:\n
return "%s/index_html" % software_product.getDefaultImageAbsoluteUrl()\n return "%s/index_html" % software_product.getDefaultImageAbsoluteUrl()\n
......
<?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>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[
"""Dirty copy&paste of portal_workflow.software_instance_slap_interface_workflow.scripts.SoftwareInstance_getInstancePackingListLine"""\n
software_instance = context\n
\n
portal = software_instance.getPortalObject()\n
\n
# Get services\n
portal_preferences = portal.portal_preferences\n
service_uid_list = []\n
\n
if service_relative_url is None:\n
for service_relative_url in \\\n
(portal_preferences.getPreferredInstanceSetupResource(),\n
portal_preferences.getPreferredInstanceHostingResource(),\n
portal_preferences.getPreferredInstanceCleanupResource(),\n
):\n
service = portal.restrictedTraverse(service_relative_url)\n
service_uid_list.append(service.getUid())\n
else:\n
service = portal.restrictedTraverse(service_relative_url)\n
service_uid_list.append(service.getUid())\n
\n
# Packing List valid state\n
state_list = ["ordered"]\n
state_list.extend(portal.getPortalReservedInventoryStateList())\n
state_list.extend(portal.getPortalTransitInventoryStateList())\n
state_list.extend(portal.getPortalCurrentInventoryStateList())\n
\n
packing_list_line = portal.portal_catalog.getResultValue(\n
portal_type=portal_type,\n
simulation_state=state_list,\n
default_aggregate_uid=software_instance.getUid(),\n
default_resource_uid=service_uid_list,\n
sort_on=((\'movement.start_date\', \'DESC\'),),\n
limit=1,\n
)\n
\n
return packing_list_line\n
]]></string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>service_relative_url=None, portal_type="Sale Packing List Line"</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SoftwareInstance_getInstancePackingListLine</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -50,58 +50,39 @@ ...@@ -50,58 +50,39 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string>"""Dirty script to return Software Instance state"""\n
"""Dirty script to return Software Instance state"""\n
if context.getPortalType() == "Sale Order Line":\n if context.getPortalType() == "Sale Order Line":\n
return "Under Approval"\n return "Under Approval"\n
\n else:\n
sale_packing_list_line = context.SoftwareInstance_getInstancePackingListLine()\n state = context.getSlapState()\n
if sale_packing_list_line is None:\n has_partition = context.getAggregate(portal_type="Computer Partition")\n
sale_packing_list_line = context.SoftwareInstance_getInstancePackingListLine(portal_type="Sale Order Line")\n if state in ["start_requested", "stop_requested"]:\n
if sale_packing_list_line is None:\n if not has_partition:\n
if context.getPortalObject().portal_catalog.countResults(\n
portal_type=\'Sale Order Line\',\n
simulation_state=\'cancelled\',\n
default_aggregate_uid=context.getUid(),\n
default_resource_uid=context.restrictedTraverse(context.getPortalObject().portal_preferences.getPreferredInstanceSetupResource()).getUid()\n
)[0][0] > 0:\n
return \'Destroyed\'\n
# Let\'s hope the sale order is not indexed yet\n
return \'Looking for a free partition\'\n
\n
service_url = sale_packing_list_line.getResource()\n
\n
portal_preferences = context.getPortalObject().portal_preferences\n
simulation_state = sale_packing_list_line.getSimulationState()\n
if service_url == portal_preferences.getPreferredInstanceSetupResource():\n
if simulation_state == \'delivered\':\n
return \'Destroyed\'\n
elif simulation_state in (\'confirmed\', ):\n
return \'Waiting for partition instanciation\'\n
elif simulation_state in (\'started\', ):\n
return \'Instanciation in progress\'\n
elif simulation_state in (\'ordered\', ):\n
return \'Looking for a free partition\'\n return \'Looking for a free partition\'\n
return \'Stopped\'\n else:\n
elif service_url == portal_preferences.getPreferredInstanceCleanupResource():\n delivery = context.getCausalityValue()\n
if simulation_state == \'delivered\':\n delivery_state = delivery.getSimulationState()\n
return \'Destroyed\'\n if state == "start_requested":\n
return \'Destruction in progress\'\n if delivery_state in ["confirmed", "started"]:\n
elif service_url == portal_preferences.getPreferredInstanceHostingResource():\n
if simulation_state == \'confirmed\':\n
return \'Start in progress\'\n return \'Start in progress\'\n
elif simulation_state == \'started\':\n else:\n
return \'Started\'\n return \'Started\'\n
elif simulation_state == \'stopped\':\n \n
elif state == "stop_requested":\n
if delivery_state in ["confirmed", "started"]:\n
return \'Stop in progress\'\n return \'Stop in progress\'\n
elif simulation_state == \'delivered\':\n else:\n
return \'Stopped\'\n return \'Stopped\'\n
\n \n
return \'Unable to calculate the status...\'\n elif state in ["destroy_requested"]:\n
if has_partition:\n
return \'Destruction in progress\'\n
]]></string> </value> else:\n
return \'Destroyed\'\n
\n
else:\n
return \'Unable to calculate the status...\'\n
</string> </value>
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
......
744 745
\ No newline at end of file \ No newline at end of file
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