Commit 206c02df authored by Romain Courteaud's avatar Romain Courteaud

Drop Item_getInstancePackingListLine.

Packing can be fetch from instance directly.
parent 99c8d5ff
...@@ -60,22 +60,15 @@ if slap_state == \'free\':\n ...@@ -60,22 +60,15 @@ if slap_state == \'free\':\n
\n \n
elif slap_state == \'busy\':\n elif slap_state == \'busy\':\n
\n \n
# Partition under destruction does not accept new slave\n instance = portal.portal_catalog.getResultValue(\n
try:\n portal_type="Software Instance",\n
delivery_line = context.Item_getInstancePackingListLine(service_relative_url=portal_preferences.getPreferredInstanceCleanupResource(), aggregate_portal_type=\'Software Instance\')\n validation_state="validated",\n
except ValueError:\n default_aggregate_uid=context.getUid(),\n
pass\n )\n
if instance is None:\n
return []\n
else:\n else:\n
if delivery_line.getSimulationState() != \'delivered\':\n return [instance.getRootSoftwareReleaseUrl()]\n
return []\n
\n
try:\n
delivery_line = context.Item_getInstancePackingListLine()\n
except ValueError:\n
pass\n
else:\n
software_release = delivery_line.getAggregateValue(portal_type=\'Software Release\')\n
return [software_release.getUrlString()]\n
\n \n
else:\n else:\n
return []\n return []\n
......
...@@ -50,15 +50,15 @@ ...@@ -50,15 +50,15 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>try:\n <value> <string>instance = context.getPortalObject().portal_catalog.getResultValue(\n
delivery_line = context.Item_getInstancePackingListLine()\n portal_type="Software Instance",\n
except ValueError:\n validation_state="validated",\n
pass\n default_aggregate_uid=context.getUid(),\n
)\n
if instance is None:\n
return ""\n
else:\n else:\n
software_instance = delivery_line.getAggregateValue(portal_type=[\'Software Instance\', \'Slave Instance\'])\n return instance.getSourceReference()\n
if software_instance is not None:\n
return software_instance.getSourceReference()\n
return ""\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
<?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># XXX: Copy of software_instance_slap_interface_workflow/scripts/SoftwareInstance_getInstancePackingListLine\n
# XXX: It is not decided yet where to put such method.\n
# XXX: Unfortunately not available outside of workflow\n
item = context\n
\n
portal = item.getPortalObject()\n
\n
# Get services\n
portal_preferences = portal.portal_preferences\n
service_uid_list = []\n
\n
if aggregate_portal_type is None:\n
aggregate_portal_type = [\'Software Instance\', \'Slave Instance\']\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 = []\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=\'Sale Packing List Line\',\n
simulation_state=state_list,\n
aggregate_uid=item.getUid(),\n
default_resource_uid=service_uid_list,\n
sort_on=((\'movement.start_date\', \'DESC\'),),\n
limit=1,\n
aggregate_portal_type=aggregate_portal_type\n
)\n
\n
if packing_list_line is None:\n
raise ValueError("No sale packing list line found for %s" % \\\n
item.getRelativeUrl())\n
else:\n
return packing_list_line\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>service_relative_url=None, aggregate_portal_type=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Item_getInstancePackingListLine</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
451 452
\ 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