diff --git a/master/bt5/vifib_open_trade/WorkflowTemplateItem/portal_workflow/vifib_open_order_interaction_workflow/scripts/Delivery_assignComputerPartition.xml b/master/bt5/vifib_open_trade/WorkflowTemplateItem/portal_workflow/vifib_open_order_interaction_workflow/scripts/Delivery_assignComputerPartition.xml index 6c72877fbc78efcc2940bd353768ac3c5d8a1f61..b48fae17354b62341fad4a63bf78e4ee63d3681a 100644 --- a/master/bt5/vifib_open_trade/WorkflowTemplateItem/portal_workflow/vifib_open_order_interaction_workflow/scripts/Delivery_assignComputerPartition.xml +++ b/master/bt5/vifib_open_trade/WorkflowTemplateItem/portal_workflow/vifib_open_order_interaction_workflow/scripts/Delivery_assignComputerPartition.xml @@ -50,7 +50,22 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string>order = state_change[\'object\']\n + <value> <string>def checkSoftwareInstanceIsInstalledOnComputerPartition(software_release,\n + computer_partition):\n + from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery\n + portal = context.getPortalObject()\n + query = ComplexQuery(Query(aggregate_relative_url=software_release.getRelativeUrl()),\n + Query(aggregate_relative_url=computer_partition.getRelativeUrl()),\n + operator="AND",\n + )\n + sale_packing_list_line = portal.portal_catalog.getResultValue(\n + portal_type=\'Sale Packing List Line\', aggregate_relative_url=query)\n + if sale_packing_list_line is not None:\n + return True\n + return False\n +\n +\n +order = state_change[\'object\']\n portal = order.getPortalObject()\n \n setup_service_relative_url = order.portal_preferences.getPreferredInstanceSetupResource()\n @@ -86,10 +101,15 @@ for order_line in order.getMovementList():\n limit=(random.randint(0, offset), 50), **query_kw):\n computer_partition_candidate = computer_partition_candidate.getObject() \n # Check if the computer partition can be marked as busy (done by an interaction workflow on sale packing list level)\n - if isTransitionPossible(computer_partition_candidate, \'mark_busy\') or software_instance.getPortalType() == "Slave Instance":\n + software_instance_portal_type = software_instance.getPortalType()\n + if isTransitionPossible(computer_partition_candidate, \'mark_busy\') and \\\n + software_instance_portal_type == "Software Instance":\n + computer_partition = computer_partition_candidate\n + break\n + elif software_instance_portal_type == "Slave Instance" and \\\n + checkSoftwareInstanceIsInstalledOnComputerPartition(software_release, computer_partition_candidate):\n computer_partition = computer_partition_candidate\n break \n -\n if computer_partition is None:\n raise ValueError(\'It was not possible to find free Computer Partition\')\n \n diff --git a/master/bt5/vifib_open_trade/bt/revision b/master/bt5/vifib_open_trade/bt/revision index 0fa6a7b088051e48b8dc94d598b7e324e6f691c9..a46c9d2265d70e913acb0e0935a4cd167ac4773c 100644 --- a/master/bt5/vifib_open_trade/bt/revision +++ b/master/bt5/vifib_open_trade/bt/revision @@ -1 +1 @@ -90 \ No newline at end of file +91 \ No newline at end of file