From 8d6db017b6a9424e15415af58596f1f1d4c450bc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=81ukasz=20Nowak?= <luke@nexedi.com>
Date: Thu, 15 Nov 2012 10:21:23 +0100
Subject: [PATCH] Finalise 0a34f141c5fa6ab6bfc7f77f40659ecbe5b305bf

Also deliver immediately.
---
 .../SlapOSSalePackingList_postGeneration.xml  |  15 +-
 master/bt5/slapos_accounting/bt/revision      |   2 +-
 .../SalePackingList_deliverInstanceSetup.xml  |  80 ----
 .../VifibDeliveryBuilder_selectMovement.xml   | 349 ------------------
 .../VifibSalePackingList_postGeneration.xml   |  89 -----
 master/bt5/vifib_base/bt/revision             |   2 +-
 6 files changed, 10 insertions(+), 527 deletions(-)
 delete mode 100644 master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_simulation/SalePackingList_deliverInstanceSetup.xml
 delete mode 100644 master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_simulation/VifibDeliveryBuilder_selectMovement.xml
 delete mode 100644 master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_simulation/VifibSalePackingList_postGeneration.xml

diff --git a/master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SlapOSSalePackingList_postGeneration.xml b/master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SlapOSSalePackingList_postGeneration.xml
index 951d943ff..6d4eff281 100644
--- a/master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SlapOSSalePackingList_postGeneration.xml
+++ b/master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/SlapOSSalePackingList_postGeneration.xml
@@ -61,17 +61,18 @@ except AttributeError:\n
   # does not come from Order\n
   pass\n
 \n
-# Then, modify state\n
-packing_list.Delivery_confirm()\n
+comment = translateString(\'Automatic transition during build.\')\n
+if portal.portal_workflow.isTransitionPossible(context, \'confirm\'):\n
+  context.confirm(comment=comment)\n
+if portal.portal_workflow.isTransitionPossible(context, \'start\'):\n
+  context.start(comment=comment)\n
+  context.stop(comment=comment)\n
+  context.deliver(comment=comment)\n
 \n
 line = packing_list.contentValues(portal_type=\'Sale Packing List Line\')[0]\n
 portal = packing_list.getPortalObject()\n
 \n
-if line.getResource() == portal.portal_preferences.getPreferredInstanceSetupResource():\n
-  packing_list.activate(after_path_and_method_id=(packing_list.getPath(),\n
-  (\'immediateReindexObject\', \'recursiveImmediateReindexObject\'))).SalePackingList_deliverInstanceSetup()\n
-\n
-# First set the packing_list in the building state\n
+# Initialise causality workflow\n
 packing_list.startBuilding()\n
 </string> </value>
         </item>
diff --git a/master/bt5/slapos_accounting/bt/revision b/master/bt5/slapos_accounting/bt/revision
index b74e882ae..1758dddcc 100644
--- a/master/bt5/slapos_accounting/bt/revision
+++ b/master/bt5/slapos_accounting/bt/revision
@@ -1 +1 @@
-31
\ No newline at end of file
+32
\ No newline at end of file
diff --git a/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_simulation/SalePackingList_deliverInstanceSetup.xml b/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_simulation/SalePackingList_deliverInstanceSetup.xml
deleted file mode 100644
index 0d3573700..000000000
--- a/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_simulation/SalePackingList_deliverInstanceSetup.xml
+++ /dev/null
@@ -1,80 +0,0 @@
-<?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>from Products.ERP5Type.Message import translateString\n
-if context.getPortalType() != \'Sale Packing List\':\n
-  raise TypeError(\'%r is not Sale Packing List\' % context.getPath())\n
-line = context.contentValues(portal_type=\'Sale Packing List Line\')[0]\n
-\n
-portal = context.getPortalObject()\n
-if line.getResource() != portal.portal_preferences.getPreferredInstanceSetupResource():\n
-  raise TypeError(\'%r is not Instance Setup Sale Packing List\' % context.getPath())\n
-\n
-comment = translateString(\'Automatic transition on setup delivery.\')\n
-if portal.portal_workflow.isTransitionPossible(context, \'start\'):\n
-  context.start(comment=comment)\n
-  context.stop(comment=comment)\n
-  context.deliver(comment=comment)\n
-</string> </value>
-        </item>
-        <item>
-            <key> <string>_params</string> </key>
-            <value> <string></string> </value>
-        </item>
-        <item>
-            <key> <string>id</string> </key>
-            <value> <string>SalePackingList_deliverInstanceSetup</string> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-</ZopeData>
diff --git a/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_simulation/VifibDeliveryBuilder_selectMovement.xml b/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_simulation/VifibDeliveryBuilder_selectMovement.xml
deleted file mode 100644
index 1b2162319..000000000
--- a/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_simulation/VifibDeliveryBuilder_selectMovement.xml
+++ /dev/null
@@ -1,349 +0,0 @@
-<?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>_Access_contents_information_Permission</string> </key>
-            <value>
-              <list>
-                <string>Assignee</string>
-                <string>Assignor</string>
-                <string>Associate</string>
-                <string>Authenticated</string>
-                <string>Author</string>
-                <string>Manager</string>
-                <string>Member</string>
-                <string>Owner</string>
-              </list>
-            </value>
-        </item>
-        <item>
-            <key> <string>_Change_Python_Scripts_Permission</string> </key>
-            <value>
-              <list>
-                <string>Assignee</string>
-                <string>Assignor</string>
-                <string>Associate</string>
-                <string>Authenticated</string>
-                <string>Author</string>
-                <string>Manager</string>
-                <string>Member</string>
-                <string>Owner</string>
-              </list>
-            </value>
-        </item>
-        <item>
-            <key> <string>_Change_bindings_Permission</string> </key>
-            <value>
-              <list>
-                <string>Assignee</string>
-                <string>Assignor</string>
-                <string>Associate</string>
-                <string>Authenticated</string>
-                <string>Author</string>
-                <string>Manager</string>
-                <string>Member</string>
-                <string>Owner</string>
-              </list>
-            </value>
-        </item>
-        <item>
-            <key> <string>_Change_cache_settings_Permission</string> </key>
-            <value>
-              <list>
-                <string>Assignee</string>
-                <string>Assignor</string>
-                <string>Associate</string>
-                <string>Authenticated</string>
-                <string>Author</string>
-                <string>Manager</string>
-                <string>Member</string>
-                <string>Owner</string>
-              </list>
-            </value>
-        </item>
-        <item>
-            <key> <string>_Change_permissions_Permission</string> </key>
-            <value>
-              <list>
-                <string>Assignee</string>
-                <string>Assignor</string>
-                <string>Associate</string>
-                <string>Authenticated</string>
-                <string>Author</string>
-                <string>Manager</string>
-                <string>Member</string>
-                <string>Owner</string>
-              </list>
-            </value>
-        </item>
-        <item>
-            <key> <string>_Change_proxy_roles_Permission</string> </key>
-            <value>
-              <list>
-                <string>Assignee</string>
-                <string>Assignor</string>
-                <string>Associate</string>
-                <string>Authenticated</string>
-                <string>Author</string>
-                <string>Manager</string>
-                <string>Member</string>
-                <string>Owner</string>
-              </list>
-            </value>
-        </item>
-        <item>
-            <key> <string>_Copy_or_Move_Permission</string> </key>
-            <value>
-              <list>
-                <string>Assignee</string>
-                <string>Assignor</string>
-                <string>Associate</string>
-                <string>Authenticated</string>
-                <string>Author</string>
-                <string>Manager</string>
-                <string>Member</string>
-                <string>Owner</string>
-              </list>
-            </value>
-        </item>
-        <item>
-            <key> <string>_Delete_objects_Permission</string> </key>
-            <value>
-              <list>
-                <string>Assignee</string>
-                <string>Assignor</string>
-                <string>Associate</string>
-                <string>Authenticated</string>
-                <string>Author</string>
-                <string>Manager</string>
-                <string>Member</string>
-                <string>Owner</string>
-              </list>
-            </value>
-        </item>
-        <item>
-            <key> <string>_Manage_WebDAV_Locks_Permission</string> </key>
-            <value>
-              <list>
-                <string>Assignee</string>
-                <string>Assignor</string>
-                <string>Associate</string>
-                <string>Authenticated</string>
-                <string>Author</string>
-                <string>Manager</string>
-                <string>Member</string>
-                <string>Owner</string>
-              </list>
-            </value>
-        </item>
-        <item>
-            <key> <string>_Manage_properties_Permission</string> </key>
-            <value>
-              <list>
-                <string>Assignee</string>
-                <string>Assignor</string>
-                <string>Associate</string>
-                <string>Authenticated</string>
-                <string>Author</string>
-                <string>Manager</string>
-                <string>Member</string>
-                <string>Owner</string>
-              </list>
-            </value>
-        </item>
-        <item>
-            <key> <string>_Take_ownership_Permission</string> </key>
-            <value>
-              <list>
-                <string>Assignee</string>
-                <string>Assignor</string>
-                <string>Associate</string>
-                <string>Authenticated</string>
-                <string>Author</string>
-                <string>Manager</string>
-                <string>Member</string>
-                <string>Owner</string>
-              </list>
-            </value>
-        </item>
-        <item>
-            <key> <string>_Undo_changes_Permission</string> </key>
-            <value>
-              <list>
-                <string>Assignee</string>
-                <string>Assignor</string>
-                <string>Associate</string>
-                <string>Authenticated</string>
-                <string>Author</string>
-                <string>Manager</string>
-                <string>Member</string>
-                <string>Owner</string>
-              </list>
-            </value>
-        </item>
-        <item>
-            <key> <string>_View_History_Permission</string> </key>
-            <value>
-              <list>
-                <string>Assignee</string>
-                <string>Assignor</string>
-                <string>Associate</string>
-                <string>Authenticated</string>
-                <string>Author</string>
-                <string>Manager</string>
-                <string>Member</string>
-                <string>Owner</string>
-              </list>
-            </value>
-        </item>
-        <item>
-            <key> <string>_View_Permission</string> </key>
-            <value>
-              <list>
-                <string>Assignee</string>
-                <string>Assignor</string>
-                <string>Associate</string>
-                <string>Authenticated</string>
-                <string>Author</string>
-                <string>Manager</string>
-                <string>Member</string>
-                <string>Owner</string>
-              </list>
-            </value>
-        </item>
-        <item>
-            <key> <string>_View_management_screens_Permission</string> </key>
-            <value>
-              <list>
-                <string>Assignee</string>
-                <string>Assignor</string>
-                <string>Associate</string>
-                <string>Authenticated</string>
-                <string>Author</string>
-                <string>Manager</string>
-                <string>Member</string>
-                <string>Owner</string>
-              </list>
-            </value>
-        </item>
-        <item>
-            <key> <string>_WebDAV_Lock_items_Permission</string> </key>
-            <value>
-              <list>
-                <string>Assignee</string>
-                <string>Assignor</string>
-                <string>Associate</string>
-                <string>Authenticated</string>
-                <string>Author</string>
-                <string>Manager</string>
-                <string>Member</string>
-                <string>Owner</string>
-              </list>
-            </value>
-        </item>
-        <item>
-            <key> <string>_WebDAV_Unlock_items_Permission</string> </key>
-            <value>
-              <list>
-                <string>Assignee</string>
-                <string>Assignor</string>
-                <string>Associate</string>
-                <string>Authenticated</string>
-                <string>Author</string>
-                <string>Manager</string>
-                <string>Member</string>
-                <string>Owner</string>
-              </list>
-            </value>
-        </item>
-        <item>
-            <key> <string>_WebDAV_access_Permission</string> </key>
-            <value>
-              <list>
-                <string>Assignee</string>
-                <string>Assignor</string>
-                <string>Associate</string>
-                <string>Authenticated</string>
-                <string>Author</string>
-                <string>Manager</string>
-                <string>Member</string>
-                <string>Owner</string>
-              </list>
-            </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>select_dict= {\'delivery_uid\': None}\n
-kw[\'select_dict\']=select_dict\n
-kw[\'left_join_list\']=select_dict.keys()\n
-kw[\'delivery_uid\']=None\n
-kw[\'group_by\']=(\'uid\',)\n
-if src__==0:\n
-  return context.portal_catalog(**kw)\n
-else:\n
-  return context.portal_catalog(src__=1, **kw)\n
-</string> </value>
-        </item>
-        <item>
-            <key> <string>_params</string> </key>
-            <value> <string>src__=0, **kw</string> </value>
-        </item>
-        <item>
-            <key> <string>id</string> </key>
-            <value> <string>VifibDeliveryBuilder_selectMovement</string> </value>
-        </item>
-        <item>
-            <key> <string>title</string> </key>
-            <value> <string></string> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-</ZopeData>
diff --git a/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_simulation/VifibSalePackingList_postGeneration.xml b/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_simulation/VifibSalePackingList_postGeneration.xml
deleted file mode 100644
index a6285003f..000000000
--- a/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_simulation/VifibSalePackingList_postGeneration.xml
+++ /dev/null
@@ -1,89 +0,0 @@
-<?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>if related_simulation_movement_path_list is None:\n
-  raise RuntimeError, \'related_simulation_movement_path_list is missing. Update ERP5 Product.\'\n
-\n
-packing_list = context\n
-\n
-try:\n
-  packing_list.PackingList_copyOrderProperties()\n
-except AttributeError:\n
-  # does not come from Order\n
-  pass\n
-\n
-# Then, modify state\n
-packing_list.Delivery_confirm()\n
-\n
-line = packing_list.contentValues(portal_type=\'Sale Packing List Line\')[0]\n
-portal = packing_list.getPortalObject()\n
-\n
-if line.getResource() == portal.portal_preferences.getPreferredInstanceSetupResource():\n
-  packing_list.activate(after_path_and_method_id=(packing_list.getPath(),\n
-  (\'immediateReindexObject\', \'recursiveImmediateReindexObject\'))).SalePackingList_deliverInstanceSetup()\n
-\n
-# First set the packing_list in the building state\n
-packing_list.startBuilding()\n
-</string> </value>
-        </item>
-        <item>
-            <key> <string>_params</string> </key>
-            <value> <string>related_simulation_movement_path_list=None</string> </value>
-        </item>
-        <item>
-            <key> <string>id</string> </key>
-            <value> <string>VifibSalePackingList_postGeneration</string> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-</ZopeData>
diff --git a/master/bt5/vifib_base/bt/revision b/master/bt5/vifib_base/bt/revision
index 54a584dec..37e6f1741 100644
--- a/master/bt5/vifib_base/bt/revision
+++ b/master/bt5/vifib_base/bt/revision
@@ -1 +1 @@
-514
\ No newline at end of file
+515
\ No newline at end of file
-- 
2.30.9