From 958760a6dda550acad4fd8c111a2f777d56334fa Mon Sep 17 00:00:00 2001
From: Rafael Monnerat <rafael@nexedi.com>
Date: Wed, 27 Jul 2011 18:37:08 -0300
Subject: [PATCH] Packing lists related to Slave Instances do not change state
 of Computer Partition

---
 .../scripts/SalePackingList_markComputerPartitionBusy.xml | 8 +++++---
 .../scripts/SalePackingList_markComputerPartitionFree.xml | 8 +++++---
 master/bt5/vifib_slap/bt/revision                         | 2 +-
 3 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/scripts/SalePackingList_markComputerPartitionBusy.xml b/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/scripts/SalePackingList_markComputerPartitionBusy.xml
index 59c68289d..b98305366 100644
--- a/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/scripts/SalePackingList_markComputerPartitionBusy.xml
+++ b/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/scripts/SalePackingList_markComputerPartitionBusy.xml
@@ -63,9 +63,11 @@ if sale_order is None:\n
       if computer_partition is None:\n
         raise ValueError("Sale Packing List Line \'%s\' should have a computer partition aggregated" % sale_packing_list_line.getRelativeUrl())\n
       else:\n
-        # Mark computer partition as busy\n
-        # This method should be always callable in this step to prevent having 2 packing list related to the same computer partition\n
-        computer_partition.markBusy()\n
+        # Slave instance do not change state of computer partitions.\n
+        if sale_packing_list_line.getAggregate(portal_type=["Slave Instance"]) is None:\n
+          # Mark computer partition as busy\n
+          # This method should be always callable in this step to prevent having 2 packing list related to the same computer partition\n
+          computer_partition.markBusy()\n
 </string> </value>
         </item>
         <item>
diff --git a/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/scripts/SalePackingList_markComputerPartitionFree.xml b/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/scripts/SalePackingList_markComputerPartitionFree.xml
index 4462f8290..8449fcc0b 100644
--- a/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/scripts/SalePackingList_markComputerPartitionFree.xml
+++ b/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/scripts/SalePackingList_markComputerPartitionFree.xml
@@ -67,9 +67,11 @@ computer_partition = current_delivery_line.getAggregateValue(portal_type=["Compu
 if computer_partition is None:\n
   raise ValueError("Sale Packing List Line \'%s\' should have a computer partition aggregated" % current_delivery_line.getRelativeUrl())\n
 else:\n
-  # Mark computer partition as free\n
-  # This method should be always callable in this step to prevent having 2 packing list related to the same computer partition\n
-  computer_partition.markFree()\n
+  # Slave instance do not change state of computer partitions.\n
+  if sale_packing_list_line.getAggregate(portal_type=["Slave Instance"]) is None:\n
+    # Mark computer partition as free\n
+    # This method should be always callable in this step to prevent having 2 packing list related to the same computer partition\n
+    computer_partition.markFree()\n
 \n
 # Deliver all SPL related to this software instance\n
 software_instance = current_delivery_line.getAggregateValue(portal_type="Software Instance")\n
diff --git a/master/bt5/vifib_slap/bt/revision b/master/bt5/vifib_slap/bt/revision
index cdf1f34dc..57db2e978 100644
--- a/master/bt5/vifib_slap/bt/revision
+++ b/master/bt5/vifib_slap/bt/revision
@@ -1 +1 @@
-403
\ No newline at end of file
+404
\ No newline at end of file
-- 
2.30.9