From 262e68c33ad98adaed09cc850e7be9fe495eb4c5 Mon Sep 17 00:00:00 2001
From: Wenjie Zheng <wenjie.zheng@tiolive.com>
Date: Mon, 26 Jan 2015 15:39:55 +0000
Subject: [PATCH] A version which role mapping works correctly as DCWorflow.
 But no group mapping.

---
 .../portal_types/PermissionRoles.xml          |  56 --------
 .../portal_types/State.xml                    | 129 ------------------
 .../portal_types/Transition%20Variable.xml    | 122 -----------------
 .../portal_types/Transition.xml               | 122 -----------------
 .../portal_types/Variable.xml                 | 105 --------------
 .../portal_types/Workflow%20Module.xml        | 120 ----------------
 .../portal_types/Workflow.xml                 | 121 ----------------
 .../portal_types/Worklist.xml                 |  38 ------
 .../portal_skins/erp5_test.xml                |  26 ----
 .../portal_skins/erp5_test/test_file.xml      |  42 ------
 bt5/test_core/bt/template_format_version      |   1 -
 bt5/test_core/bt/template_skin_id_list        |   1 -
 bt5/test_core/bt/title                        |   1 -
 bt5/test_core/bt/version                      |   1 -
 product/ERP5Type/Base.py                      |   3 +-
 product/ERP5Type/ERP5Type.py                  |   4 +-
 .../ERP5Workflow/Document/PermissionRoles.py  |  23 ++--
 product/ERP5Workflow/Document/State.py        |   2 +
 product/ERP5Workflow/Document/Workflow.py     |  30 ++--
 19 files changed, 35 insertions(+), 912 deletions(-)
 delete mode 100644 bt5/erp5_workflow/PortalTypeTemplateItem/portal_types/PermissionRoles.xml
 delete mode 100644 bt5/erp5_workflow/PortalTypeTemplateItem/portal_types/State.xml
 delete mode 100644 bt5/erp5_workflow/PortalTypeTemplateItem/portal_types/Transition%20Variable.xml
 delete mode 100644 bt5/erp5_workflow/PortalTypeTemplateItem/portal_types/Transition.xml
 delete mode 100644 bt5/erp5_workflow/PortalTypeTemplateItem/portal_types/Variable.xml
 delete mode 100644 bt5/erp5_workflow/PortalTypeTemplateItem/portal_types/Workflow%20Module.xml
 delete mode 100644 bt5/erp5_workflow/PortalTypeTemplateItem/portal_types/Workflow.xml
 delete mode 100644 bt5/erp5_workflow/PortalTypeTemplateItem/portal_types/Worklist.xml
 delete mode 100644 bt5/test_core/SkinTemplateItem/portal_skins/erp5_test.xml
 delete mode 100644 bt5/test_core/SkinTemplateItem/portal_skins/erp5_test/test_file.xml
 delete mode 100644 bt5/test_core/bt/template_format_version
 delete mode 100644 bt5/test_core/bt/template_skin_id_list
 delete mode 100644 bt5/test_core/bt/title
 delete mode 100644 bt5/test_core/bt/version

diff --git a/bt5/erp5_workflow/PortalTypeTemplateItem/portal_types/PermissionRoles.xml b/bt5/erp5_workflow/PortalTypeTemplateItem/portal_types/PermissionRoles.xml
deleted file mode 100644
index 00071d4768..0000000000
--- a/bt5/erp5_workflow/PortalTypeTemplateItem/portal_types/PermissionRoles.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0"?>
-<ZopeData>
-  <record id="1" aka="AAAAAAAAAAE=">
-    <pickle>
-      <global name="Base Type" module="erp5.portal_type"/>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>content_icon</string> </key>
-            <value> <string>document.gif</string> </value>
-        </item>
-        <item>
-            <key> <string>description</string> </key>
-            <value> <string>An ERP5 permission roles bonder.</string> </value>
-        </item>
-        <item>
-            <key> <string>id</string> </key>
-            <value> <string>PermissionRoles</string> </value>
-        </item>
-        <item>
-            <key> <string>init_script</string> </key>
-            <value>
-              <none/>
-            </value>
-        </item>
-        <item>
-            <key> <string>permission</string> </key>
-            <value>
-              <none/>
-            </value>
-        </item>
-        <item>
-            <key> <string>portal_type</string> </key>
-            <value> <string>Base Type</string> </value>
-        </item>
-        <item>
-            <key> <string>type_class</string> </key>
-            <value> <string>PermissionRoles</string> </value>
-        </item>
-        <item>
-            <key> <string>type_interface</string> </key>
-            <value>
-              <tuple/>
-            </value>
-        </item>
-        <item>
-            <key> <string>type_mixin</string> </key>
-            <value>
-              <tuple/>
-            </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-</ZopeData>
diff --git a/bt5/erp5_workflow/PortalTypeTemplateItem/portal_types/State.xml b/bt5/erp5_workflow/PortalTypeTemplateItem/portal_types/State.xml
deleted file mode 100644
index eae51091b1..0000000000
--- a/bt5/erp5_workflow/PortalTypeTemplateItem/portal_types/State.xml
+++ /dev/null
@@ -1,129 +0,0 @@
-<?xml version="1.0"?>
-<ZopeData>
-  <record id="1" aka="AAAAAAAAAAE=">
-    <pickle>
-      <global name="Base Type" module="erp5.portal_type"/>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>_property_domain_dict</string> </key>
-            <value>
-              <dictionary>
-                <item>
-                    <key> <string>short_title</string> </key>
-                    <value>
-                      <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
-                    </value>
-                </item>
-                <item>
-                    <key> <string>title</string> </key>
-                    <value>
-                      <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
-                    </value>
-                </item>
-              </dictionary>
-            </value>
-        </item>
-        <item>
-            <key> <string>content_icon</string> </key>
-            <value> <string>document.gif</string> </value>
-        </item>
-        <item>
-            <key> <string>content_meta_type</string> </key>
-            <value> <string>ERP5 State</string> </value>
-        </item>
-        <item>
-            <key> <string>description</string> </key>
-            <value> <string>\n
-    A ERP5 State.\n
-</string> </value>
-        </item>
-        <item>
-            <key> <string>factory</string> </key>
-            <value> <string>addState</string> </value>
-        </item>
-        <item>
-            <key> <string>id</string> </key>
-            <value> <string>State</string> </value>
-        </item>
-        <item>
-            <key> <string>init_script</string> </key>
-            <value>
-              <none/>
-            </value>
-        </item>
-        <item>
-            <key> <string>permission</string> </key>
-            <value>
-              <none/>
-            </value>
-        </item>
-        <item>
-            <key> <string>title</string> </key>
-            <value> <string></string> </value>
-        </item>
-        <item>
-            <key> <string>type_class</string> </key>
-            <value> <string>State</string> </value>
-        </item>
-        <item>
-            <key> <string>type_interface</string> </key>
-            <value>
-              <tuple/>
-            </value>
-        </item>
-        <item>
-            <key> <string>type_mixin</string> </key>
-            <value>
-              <tuple/>
-            </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-  <record id="2" aka="AAAAAAAAAAI=">
-    <pickle>
-      <tuple>
-        <global name="TranslationInformation" module="Products.ERP5Type.TranslationProviderBase"/>
-        <tuple/>
-      </tuple>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>domain_name</string> </key>
-            <value>
-              <none/>
-            </value>
-        </item>
-        <item>
-            <key> <string>property_name</string> </key>
-            <value> <string>short_title</string> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-  <record id="3" aka="AAAAAAAAAAM=">
-    <pickle>
-      <tuple>
-        <global name="TranslationInformation" module="Products.ERP5Type.TranslationProviderBase"/>
-        <tuple/>
-      </tuple>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>domain_name</string> </key>
-            <value>
-              <none/>
-            </value>
-        </item>
-        <item>
-            <key> <string>property_name</string> </key>
-            <value> <string>title</string> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-</ZopeData>
diff --git a/bt5/erp5_workflow/PortalTypeTemplateItem/portal_types/Transition%20Variable.xml b/bt5/erp5_workflow/PortalTypeTemplateItem/portal_types/Transition%20Variable.xml
deleted file mode 100644
index 98ee69d3ee..0000000000
--- a/bt5/erp5_workflow/PortalTypeTemplateItem/portal_types/Transition%20Variable.xml
+++ /dev/null
@@ -1,122 +0,0 @@
-<?xml version="1.0"?>
-<ZopeData>
-  <record id="1" aka="AAAAAAAAAAE=">
-    <pickle>
-      <global name="Base Type" module="erp5.portal_type"/>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>_property_domain_dict</string> </key>
-            <value>
-              <dictionary>
-                <item>
-                    <key> <string>short_title</string> </key>
-                    <value>
-                      <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
-                    </value>
-                </item>
-                <item>
-                    <key> <string>title</string> </key>
-                    <value>
-                      <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
-                    </value>
-                </item>
-              </dictionary>
-            </value>
-        </item>
-        <item>
-            <key> <string>acquire_local_roles</string> </key>
-            <value> <int>1</int> </value>
-        </item>
-        <item>
-            <key> <string>content_icon</string> </key>
-            <value> <string>document.gif</string> </value>
-        </item>
-        <item>
-            <key> <string>content_meta_type</string> </key>
-            <value> <string>ERP5 Variable</string> </value>
-        </item>
-        <item>
-            <key> <string>description</string> </key>
-            <value> <string>A ERP5 Transition Variable.\n
-</string> </value>
-        </item>
-        <item>
-            <key> <string>factory</string> </key>
-            <value> <string>addVariable</string> </value>
-        </item>
-        <item>
-            <key> <string>filter_content_types</string> </key>
-            <value> <int>1</int> </value>
-        </item>
-        <item>
-            <key> <string>group_list</string> </key>
-            <value>
-              <tuple/>
-            </value>
-        </item>
-        <item>
-            <key> <string>id</string> </key>
-            <value> <string>Transition Variable</string> </value>
-        </item>
-        <item>
-            <key> <string>init_script</string> </key>
-            <value> <string></string> </value>
-        </item>
-        <item>
-            <key> <string>title</string> </key>
-            <value> <string></string> </value>
-        </item>
-        <item>
-            <key> <string>type_class</string> </key>
-            <value> <string>Variable</string> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-  <record id="2" aka="AAAAAAAAAAI=">
-    <pickle>
-      <tuple>
-        <global name="TranslationInformation" module="Products.ERP5Type.TranslationProviderBase"/>
-        <tuple/>
-      </tuple>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>domain_name</string> </key>
-            <value>
-              <none/>
-            </value>
-        </item>
-        <item>
-            <key> <string>property_name</string> </key>
-            <value> <string>short_title</string> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-  <record id="3" aka="AAAAAAAAAAM=">
-    <pickle>
-      <tuple>
-        <global name="TranslationInformation" module="Products.ERP5Type.TranslationProviderBase"/>
-        <tuple/>
-      </tuple>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>domain_name</string> </key>
-            <value>
-              <none/>
-            </value>
-        </item>
-        <item>
-            <key> <string>property_name</string> </key>
-            <value> <string>title</string> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-</ZopeData>
diff --git a/bt5/erp5_workflow/PortalTypeTemplateItem/portal_types/Transition.xml b/bt5/erp5_workflow/PortalTypeTemplateItem/portal_types/Transition.xml
deleted file mode 100644
index 24a4c95b7e..0000000000
--- a/bt5/erp5_workflow/PortalTypeTemplateItem/portal_types/Transition.xml
+++ /dev/null
@@ -1,122 +0,0 @@
-<?xml version="1.0"?>
-<ZopeData>
-  <record id="1" aka="AAAAAAAAAAE=">
-    <pickle>
-      <global name="Base Type" module="erp5.portal_type"/>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>_property_domain_dict</string> </key>
-            <value>
-              <dictionary>
-                <item>
-                    <key> <string>short_title</string> </key>
-                    <value>
-                      <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
-                    </value>
-                </item>
-                <item>
-                    <key> <string>title</string> </key>
-                    <value>
-                      <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
-                    </value>
-                </item>
-              </dictionary>
-            </value>
-        </item>
-        <item>
-            <key> <string>acquire_local_roles</string> </key>
-            <value> <int>1</int> </value>
-        </item>
-        <item>
-            <key> <string>content_icon</string> </key>
-            <value> <string>document.gif</string> </value>
-        </item>
-        <item>
-            <key> <string>content_meta_type</string> </key>
-            <value> <string>ERP5 Transition</string> </value>
-        </item>
-        <item>
-            <key> <string>description</string> </key>
-            <value> <string>    A ERP5 Transition.\n
-</string> </value>
-        </item>
-        <item>
-            <key> <string>factory</string> </key>
-            <value> <string>addTransition</string> </value>
-        </item>
-        <item>
-            <key> <string>filter_content_types</string> </key>
-            <value> <int>1</int> </value>
-        </item>
-        <item>
-            <key> <string>group_list</string> </key>
-            <value>
-              <tuple/>
-            </value>
-        </item>
-        <item>
-            <key> <string>id</string> </key>
-            <value> <string>Transition</string> </value>
-        </item>
-        <item>
-            <key> <string>init_script</string> </key>
-            <value> <string></string> </value>
-        </item>
-        <item>
-            <key> <string>title</string> </key>
-            <value> <string></string> </value>
-        </item>
-        <item>
-            <key> <string>type_class</string> </key>
-            <value> <string>Transition</string> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-  <record id="2" aka="AAAAAAAAAAI=">
-    <pickle>
-      <tuple>
-        <global name="TranslationInformation" module="Products.ERP5Type.TranslationProviderBase"/>
-        <tuple/>
-      </tuple>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>domain_name</string> </key>
-            <value>
-              <none/>
-            </value>
-        </item>
-        <item>
-            <key> <string>property_name</string> </key>
-            <value> <string>short_title</string> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-  <record id="3" aka="AAAAAAAAAAM=">
-    <pickle>
-      <tuple>
-        <global name="TranslationInformation" module="Products.ERP5Type.TranslationProviderBase"/>
-        <tuple/>
-      </tuple>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>domain_name</string> </key>
-            <value>
-              <none/>
-            </value>
-        </item>
-        <item>
-            <key> <string>property_name</string> </key>
-            <value> <string>title</string> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-</ZopeData>
diff --git a/bt5/erp5_workflow/PortalTypeTemplateItem/portal_types/Variable.xml b/bt5/erp5_workflow/PortalTypeTemplateItem/portal_types/Variable.xml
deleted file mode 100644
index f42fde0c60..0000000000
--- a/bt5/erp5_workflow/PortalTypeTemplateItem/portal_types/Variable.xml
+++ /dev/null
@@ -1,105 +0,0 @@
-<?xml version="1.0"?>
-<ZopeData>
-  <record id="1" aka="AAAAAAAAAAE=">
-    <pickle>
-      <global name="Base Type" module="erp5.portal_type"/>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>_property_domain_dict</string> </key>
-            <value>
-              <dictionary>
-                <item>
-                    <key> <string>short_title</string> </key>
-                    <value>
-                      <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
-                    </value>
-                </item>
-                <item>
-                    <key> <string>title</string> </key>
-                    <value>
-                      <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
-                    </value>
-                </item>
-              </dictionary>
-            </value>
-        </item>
-        <item>
-            <key> <string>content_icon</string> </key>
-            <value> <string>document.gif</string> </value>
-        </item>
-        <item>
-            <key> <string>content_meta_type</string> </key>
-            <value> <string>ERP5 Variable</string> </value>
-        </item>
-        <item>
-            <key> <string>description</string> </key>
-            <value> <string>\n
-    A ERP5 Variable.\n
-</string> </value>
-        </item>
-        <item>
-            <key> <string>factory</string> </key>
-            <value> <string>addVariable</string> </value>
-        </item>
-        <item>
-            <key> <string>id</string> </key>
-            <value> <string>Variable</string> </value>
-        </item>
-        <item>
-            <key> <string>title</string> </key>
-            <value> <string></string> </value>
-        </item>
-        <item>
-            <key> <string>type_class</string> </key>
-            <value> <string>Variable</string> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-  <record id="2" aka="AAAAAAAAAAI=">
-    <pickle>
-      <tuple>
-        <global name="TranslationInformation" module="Products.ERP5Type.TranslationProviderBase"/>
-        <tuple/>
-      </tuple>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>domain_name</string> </key>
-            <value>
-              <none/>
-            </value>
-        </item>
-        <item>
-            <key> <string>property_name</string> </key>
-            <value> <string>short_title</string> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-  <record id="3" aka="AAAAAAAAAAM=">
-    <pickle>
-      <tuple>
-        <global name="TranslationInformation" module="Products.ERP5Type.TranslationProviderBase"/>
-        <tuple/>
-      </tuple>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>domain_name</string> </key>
-            <value>
-              <none/>
-            </value>
-        </item>
-        <item>
-            <key> <string>property_name</string> </key>
-            <value> <string>title</string> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-</ZopeData>
diff --git a/bt5/erp5_workflow/PortalTypeTemplateItem/portal_types/Workflow%20Module.xml b/bt5/erp5_workflow/PortalTypeTemplateItem/portal_types/Workflow%20Module.xml
deleted file mode 100644
index 4ce74a11be..0000000000
--- a/bt5/erp5_workflow/PortalTypeTemplateItem/portal_types/Workflow%20Module.xml
+++ /dev/null
@@ -1,120 +0,0 @@
-<?xml version="1.0"?>
-<ZopeData>
-  <record id="1" aka="AAAAAAAAAAE=">
-    <pickle>
-      <global name="Base Type" module="erp5.portal_type"/>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>_property_domain_dict</string> </key>
-            <value>
-              <dictionary>
-                <item>
-                    <key> <string>short_title</string> </key>
-                    <value>
-                      <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
-                    </value>
-                </item>
-                <item>
-                    <key> <string>title</string> </key>
-                    <value>
-                      <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
-                    </value>
-                </item>
-              </dictionary>
-            </value>
-        </item>
-        <item>
-            <key> <string>acquire_local_roles</string> </key>
-            <value> <int>1</int> </value>
-        </item>
-        <item>
-            <key> <string>content_icon</string> </key>
-            <value> <string>folder_icon.gif</string> </value>
-        </item>
-        <item>
-            <key> <string>content_meta_type</string> </key>
-            <value> <string>ERP5 Folder</string> </value>
-        </item>
-        <item>
-            <key> <string>description</string> </key>
-            <value> <string>Folders allow to store a large number of documents (1,000,000 should not\n
-be a problem).</string> </value>
-        </item>
-        <item>
-            <key> <string>factory</string> </key>
-            <value> <string>addFolder</string> </value>
-        </item>
-        <item>
-            <key> <string>filter_content_types</string> </key>
-            <value> <int>1</int> </value>
-        </item>
-        <item>
-            <key> <string>group_list</string> </key>
-            <value>
-              <tuple>
-                <string>module</string>
-              </tuple>
-            </value>
-        </item>
-        <item>
-            <key> <string>id</string> </key>
-            <value> <string>Workflow Module</string> </value>
-        </item>
-        <item>
-            <key> <string>init_script</string> </key>
-            <value> <string></string> </value>
-        </item>
-        <item>
-            <key> <string>title</string> </key>
-            <value> <string></string> </value>
-        </item>
-        <item>
-            <key> <string>type_class</string> </key>
-            <value> <string>Folder</string> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-  <record id="2" aka="AAAAAAAAAAI=">
-    <pickle>
-      <tuple>
-        <global name="TranslationInformation" module="Products.ERP5Type.TranslationProviderBase"/>
-        <tuple/>
-      </tuple>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>domain_name</string> </key>
-            <value> <string>erp5_ui</string> </value>
-        </item>
-        <item>
-            <key> <string>property_name</string> </key>
-            <value> <string>short_title</string> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-  <record id="3" aka="AAAAAAAAAAM=">
-    <pickle>
-      <tuple>
-        <global name="TranslationInformation" module="Products.ERP5Type.TranslationProviderBase"/>
-        <tuple/>
-      </tuple>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>domain_name</string> </key>
-            <value> <string>erp5_ui</string> </value>
-        </item>
-        <item>
-            <key> <string>property_name</string> </key>
-            <value> <string>title</string> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-</ZopeData>
diff --git a/bt5/erp5_workflow/PortalTypeTemplateItem/portal_types/Workflow.xml b/bt5/erp5_workflow/PortalTypeTemplateItem/portal_types/Workflow.xml
deleted file mode 100644
index 96fef46236..0000000000
--- a/bt5/erp5_workflow/PortalTypeTemplateItem/portal_types/Workflow.xml
+++ /dev/null
@@ -1,121 +0,0 @@
-<?xml version="1.0"?>
-<ZopeData>
-  <record id="1" aka="AAAAAAAAAAE=">
-    <pickle>
-      <global name="Base Type" module="erp5.portal_type"/>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>_property_domain_dict</string> </key>
-            <value>
-              <dictionary>
-                <item>
-                    <key> <string>short_title</string> </key>
-                    <value>
-                      <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
-                    </value>
-                </item>
-                <item>
-                    <key> <string>title</string> </key>
-                    <value>
-                      <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
-                    </value>
-                </item>
-              </dictionary>
-            </value>
-        </item>
-        <item>
-            <key> <string>acquire_local_roles</string> </key>
-            <value> <int>1</int> </value>
-        </item>
-        <item>
-            <key> <string>content_icon</string> </key>
-            <value> <string>document.gif</string> </value>
-        </item>
-        <item>
-            <key> <string>content_meta_type</string> </key>
-            <value> <string>ERP5 Workflow</string> </value>
-        </item>
-        <item>
-            <key> <string>description</string> </key>
-            <value> <string>An ERP5 Workflow.</string> </value>
-        </item>
-        <item>
-            <key> <string>factory</string> </key>
-            <value> <string>addWorkflow</string> </value>
-        </item>
-        <item>
-            <key> <string>filter_content_types</string> </key>
-            <value> <int>1</int> </value>
-        </item>
-        <item>
-            <key> <string>group_list</string> </key>
-            <value>
-              <tuple/>
-            </value>
-        </item>
-        <item>
-            <key> <string>id</string> </key>
-            <value> <string>Workflow</string> </value>
-        </item>
-        <item>
-            <key> <string>init_script</string> </key>
-            <value> <string></string> </value>
-        </item>
-        <item>
-            <key> <string>title</string> </key>
-            <value> <string></string> </value>
-        </item>
-        <item>
-            <key> <string>type_class</string> </key>
-            <value> <string>Workflow</string> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-  <record id="2" aka="AAAAAAAAAAI=">
-    <pickle>
-      <tuple>
-        <global name="TranslationInformation" module="Products.ERP5Type.TranslationProviderBase"/>
-        <tuple/>
-      </tuple>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>domain_name</string> </key>
-            <value>
-              <none/>
-            </value>
-        </item>
-        <item>
-            <key> <string>property_name</string> </key>
-            <value> <string>short_title</string> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-  <record id="3" aka="AAAAAAAAAAM=">
-    <pickle>
-      <tuple>
-        <global name="TranslationInformation" module="Products.ERP5Type.TranslationProviderBase"/>
-        <tuple/>
-      </tuple>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>domain_name</string> </key>
-            <value>
-              <none/>
-            </value>
-        </item>
-        <item>
-            <key> <string>property_name</string> </key>
-            <value> <string>title</string> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-</ZopeData>
diff --git a/bt5/erp5_workflow/PortalTypeTemplateItem/portal_types/Worklist.xml b/bt5/erp5_workflow/PortalTypeTemplateItem/portal_types/Worklist.xml
deleted file mode 100644
index 28c72be7ec..0000000000
--- a/bt5/erp5_workflow/PortalTypeTemplateItem/portal_types/Worklist.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0"?>
-<ZopeData>
-  <record id="1" aka="AAAAAAAAAAE=">
-    <pickle>
-      <global name="Base Type" module="erp5.portal_type"/>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>content_icon</string> </key>
-            <value> <string>document.gif</string> </value>
-        </item>
-        <item>
-            <key> <string>content_meta_type</string> </key>
-            <value> <string>ERP5 Worklist</string> </value>
-        </item>
-        <item>
-            <key> <string>description</string> </key>
-            <value> <string>\n
-    A ERP5 Worklist.\n
-</string> </value>
-        </item>
-        <item>
-            <key> <string>factory</string> </key>
-            <value> <string>addWorklist</string> </value>
-        </item>
-        <item>
-            <key> <string>id</string> </key>
-            <value> <string>Worklist</string> </value>
-        </item>
-        <item>
-            <key> <string>title</string> </key>
-            <value> <string></string> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-</ZopeData>
diff --git a/bt5/test_core/SkinTemplateItem/portal_skins/erp5_test.xml b/bt5/test_core/SkinTemplateItem/portal_skins/erp5_test.xml
deleted file mode 100644
index 9969c9a2ab..0000000000
--- a/bt5/test_core/SkinTemplateItem/portal_skins/erp5_test.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0"?>
-<ZopeData>
-  <record id="1" aka="AAAAAAAAAAE=">
-    <pickle>
-      <global name="Folder" module="OFS.Folder"/>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>_objects</string> </key>
-            <value>
-              <tuple/>
-            </value>
-        </item>
-        <item>
-            <key> <string>id</string> </key>
-            <value> <string>erp5_test</string> </value>
-        </item>
-        <item>
-            <key> <string>title</string> </key>
-            <value> <string></string> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-</ZopeData>
diff --git a/bt5/test_core/SkinTemplateItem/portal_skins/erp5_test/test_file.xml b/bt5/test_core/SkinTemplateItem/portal_skins/erp5_test/test_file.xml
deleted file mode 100644
index c10666b27e..0000000000
--- a/bt5/test_core/SkinTemplateItem/portal_skins/erp5_test/test_file.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0"?>
-<ZopeData>
-  <record id="1" aka="AAAAAAAAAAE=">
-    <pickle>
-      <global name="File" module="OFS.Image"/>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>_EtagSupport__etag</string> </key>
-            <value> <string>ts54532722.5</string> </value>
-        </item>
-        <item>
-            <key> <string>__name__</string> </key>
-            <value> <string>test_file</string> </value>
-        </item>
-        <item>
-            <key> <string>content_type</string> </key>
-            <value> <string>text/x-unknown-content-type</string> </value>
-        </item>
-        <item>
-            <key> <string>data</string> </key>
-            <value> <string>test1\n
-test2\n
-test3</string> </value>
-        </item>
-        <item>
-            <key> <string>precondition</string> </key>
-            <value> <string></string> </value>
-        </item>
-        <item>
-            <key> <string>size</string> </key>
-            <value> <int>17</int> </value>
-        </item>
-        <item>
-            <key> <string>title</string> </key>
-            <value> <string></string> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-</ZopeData>
diff --git a/bt5/test_core/bt/template_format_version b/bt5/test_core/bt/template_format_version
deleted file mode 100644
index 56a6051ca2..0000000000
--- a/bt5/test_core/bt/template_format_version
+++ /dev/null
@@ -1 +0,0 @@
-1
\ No newline at end of file
diff --git a/bt5/test_core/bt/template_skin_id_list b/bt5/test_core/bt/template_skin_id_list
deleted file mode 100644
index 79866bd61b..0000000000
--- a/bt5/test_core/bt/template_skin_id_list
+++ /dev/null
@@ -1 +0,0 @@
-erp5_test
\ No newline at end of file
diff --git a/bt5/test_core/bt/title b/bt5/test_core/bt/title
deleted file mode 100644
index c06373af25..0000000000
--- a/bt5/test_core/bt/title
+++ /dev/null
@@ -1 +0,0 @@
-test_core
\ No newline at end of file
diff --git a/bt5/test_core/bt/version b/bt5/test_core/bt/version
deleted file mode 100644
index 9f8e9b69a3..0000000000
--- a/bt5/test_core/bt/version
+++ /dev/null
@@ -1 +0,0 @@
-1.0
\ No newline at end of file
diff --git a/product/ERP5Type/Base.py b/product/ERP5Type/Base.py
index 4beffa8ef5..fa3555f080 100644
--- a/product/ERP5Type/Base.py
+++ b/product/ERP5Type/Base.py
@@ -3383,6 +3383,7 @@ class Base( CopyContainer,
 
     workflow = self.portal_workflow.getWorkflowById(wf_id)
     erp5workflow = self.workflow_module._getOb(wf_id, None)
+    LOG('zwj: Loading %s'%erp5workflow.getId(), WARNING,'updating roles')
     if workflow is not None:
       changed = workflow.updateRoleMappingsFor(self)
       if changed:
@@ -3390,7 +3391,7 @@ class Base( CopyContainer,
 
     ### zwj: update role changed through erp5workflow
     if erp5workflow is not None:
-      changed = erp5workflow.updateRoleMappingFor(self)
+      changed = erp5workflow.updateRoleMappingsFor(self)
       if changed:
         self.reindexObjectSecurity(activate_kw={'priority':4})
 
diff --git a/product/ERP5Type/ERP5Type.py b/product/ERP5Type/ERP5Type.py
index 91d41ad4b2..86ca655db2 100644
--- a/product/ERP5Type/ERP5Type.py
+++ b/product/ERP5Type/ERP5Type.py
@@ -418,10 +418,10 @@ class ERP5TypeInformation(XMLObject,
           for workflow in workflow_tool.getWorkflowsFor(ob):
             workflow.notifyCreated(ob)
 
-        for ERP5Workflow in self.getTypeERP5WorkflowList():
+        for ERP5Workflow_id in self.getTypeERP5WorkflowList():
           workflow_module = portal.getDefaultModule(portal_type="Workflow")
           if workflow_module is not None:
-            ERP5Workflow = workflow_module._getOb(ERP5Workflow)
+            ERP5Workflow = workflow_module._getOb(ERP5Workflow_id)
             ERP5Workflow.initializeDocument(ob)
 
       if not temp_object:
diff --git a/product/ERP5Workflow/Document/PermissionRoles.py b/product/ERP5Workflow/Document/PermissionRoles.py
index d2951afb90..77b82f1aef 100644
--- a/product/ERP5Workflow/Document/PermissionRoles.py
+++ b/product/ERP5Workflow/Document/PermissionRoles.py
@@ -67,9 +67,12 @@ class PermissionRoles(XMLObject):
     return self.id
 
   def getPermissionRole(self):
+    permission = 'None'
+    role = 'None'
     if self.is_selected == 1:
-      permission_id = self.getId().split('_')[1]
-      role_id = self.getId().split('_')[2]
+      permission_id = int(self.id.split('_')[1])
+      role_id = int(self.id.split('_')[2])
+      LOG('zwj: Assign %s to %s' %(role_id, permission_id), WARNING, "in PermissionRole.")
       permission_list = sorted(self.getParent().getParent().getManagedPermissionList())
       role_list = sorted(["Anonymous", "Assignee", "Assignor", "Associate",
                 "Auditor", "Authenticated", "Author", "Manager",
@@ -77,16 +80,6 @@ class PermissionRoles(XMLObject):
       permission = permission_list[permission_id]
       role = role_list[role_id]
       LOG('zwj: Assign %s to %s' %(role, permission), WARNING, "in PermissionRole.")
-      return permission, role
-
-  def setPermissionRoleMap(self):
-    if is_selected == 1:
-      permission_id = self.id.split('_')[1]
-      role_id = self.id.split('_')[2]
-      permission_list = sorted(self.getParent().getParent().getManagedPermissionList())
-      role_list = sorted(["Anonymous", "Assignee", "Assignor", "Associate",
-                "Auditor", "Authenticated", "Author", "Manager",
-                "Member", "Owner", "Reviewer"])
-      permission = permission_list[permission_id]
-      role = role_list[role_id]
-
+    if role == 'None':
+      role = ['Manager']
+    return permission, role
diff --git a/product/ERP5Workflow/Document/State.py b/product/ERP5Workflow/Document/State.py
index 8cf19f8a1b..2c0109971f 100644
--- a/product/ERP5Workflow/Document/State.py
+++ b/product/ERP5Workflow/Document/State.py
@@ -86,6 +86,8 @@ class State(XMLObject, XMLMatrix):
       raise StateError
     else:
       transition.execute(document, form_kw=form_kw)
+      ### zwj: update Role mapping, also in Workflow, initialiseDocument()
+      self.getParent().updateRoleMappingsFor(document)
 
   def undoTransition(self, document):
     """
diff --git a/product/ERP5Workflow/Document/Workflow.py b/product/ERP5Workflow/Document/Workflow.py
index af133941bc..d990c2f5c2 100644
--- a/product/ERP5Workflow/Document/Workflow.py
+++ b/product/ERP5Workflow/Document/Workflow.py
@@ -42,6 +42,7 @@ from Products.DCWorkflowGraph.DCWorkflowGraph import bin_search, getGraph
 from Products.ERP5Type.Utils import UpperCase
 from Acquisition import aq_base
 from DateTime import DateTime
+from zLOG import LOG, ERROR, DEBUG, WARNING
 
 class Workflow(XMLObject):
   """
@@ -56,10 +57,13 @@ class Workflow(XMLObject):
 
   ### zwj: for security issue
   managed_permission = ()
-  role = None
+  managed_role = ()
   group = ()
   erp5_permission_roles = {} # { permission: [role] or (role,) }
-
+  erp5_role_groups = ()
+  role_list = sorted(["Anonymous", "Assignee", "Assignor", "Associate",
+                "Auditor", "Authenticated", "Author", "Manager",
+                "Member", "Owner", "Reviewer"])
   # Declarative security
   security = ClassSecurityInfo()
   security.declareObjectProtected(Permissions.AccessContentsInformation)
@@ -88,6 +92,8 @@ class Workflow(XMLObject):
     for variable in variable_list:
       status_dict[variable.getTitle()] = variable.getInitialValue(object=object)
     self._updateWorkflowHistory(document, status_dict)
+    ### zwj: initialize role mappings, also in State.py/executeTransition()
+    self.updateRoleMappingsFor(document)
 
   def _generateHistoryKey(self):
     """
@@ -184,15 +190,18 @@ class Workflow(XMLObject):
     ### zwj: build a permission roles dict
     for perm_role in permission_role_matrix_cells:
       permission,role = perm_role.getPermissionRole()
-      if erp5_permission_roles[permission]:
-        erp5_permission_roles[permission] = erp5_permission_roles[permission] + role
-      else:
-        erp5_permission_roles.update({permission : role})
+      LOG('zwj: Assign %s to %s' %(role, permission), WARNING, "in Workflow.")
+      if permission != 'None':
+        if self.erp5_permission_roles.has_key(permission):
+          self.erp5_permission_roles[permission] += (role,)
+        else:
+          self.erp5_permission_roles.update({permission : (role,)})
+
     ### zwj: update role list to permission
-    for permission_roles in erp5_permission_roles.keys():
-      if modifyRolesForPermission(document, permission_roles, erp5_permission_roles[permission_roles]):
+    for permission_roles in self.erp5_permission_roles.keys():
+      if modifyRolesForPermission(document, permission_roles, self.erp5_permission_roles[permission_roles]):
         changed = 1
-
+    """
     # Update the group -> role map.
     groups = self.getGroups()
     managed_roles = self.getRoles()
@@ -203,8 +212,11 @@ class Workflow(XMLObject):
                 roles = sdef.group_roles.get(group, ())
             if modifyRolesForGroup(document, group, roles, managed_roles):
                 changed = 1
+    """
     return changed
 
+  def getRoleList(self):
+    return self.role_list
 
   def _checkTransitionGuard(self, t, document, **kw):
     guard = t.guard
-- 
2.30.9