From edef0dde88a0bdfbd2a686d7c892b14d30086111 Mon Sep 17 00:00:00 2001
From: Romain Courteaud <romain@nexedi.com>
Date: Tue, 26 Apr 2022 10:17:18 +0000
Subject: [PATCH] slapos_category:

* add new business application categories
* export edger category
* automated ledger is not only for accounting
* drop allocation_scope/open categories
  All compute nodes are public now
* add use/trade/deposit category
* do not use the same title for 2 categories
* Add trade condition type categories.
  This will be used to automatically select a Trade Condition in slapos_accounting
---
 .../login.xml}                                |  22 +++-
 .../business_application/slapos.xml           |  97 +++++++++++++++
 .../portal_categories/ledger/automated.xml    | 117 ++++++++++++++++++
 .../compute_node.xml}                         |  12 +-
 .../default.xml}                              |  12 +-
 .../trade_condition_type/deposit.xml          |  73 +++++++++++
 .../trade_condition_type/instance_tree.xml    |  73 +++++++++++
 .../trade_condition_type/virtual_master.xml   |  73 +++++++++++
 .../portal_categories/use/trade/deposit.xml   |  71 +++++++++++
 .../use/trade/discount_service.xml            |   2 +-
 .../bt5/slapos_category/bt/template_path_list |   2 +
 11 files changed, 527 insertions(+), 27 deletions(-)
 rename master/bt5/slapos_category/PathTemplateItem/portal_categories/{allocation_scope/open/subscription.xml => business_application/login.xml} (79%)
 create mode 100644 master/bt5/slapos_category/PathTemplateItem/portal_categories/business_application/slapos.xml
 create mode 100644 master/bt5/slapos_category/PathTemplateItem/portal_categories/ledger/automated.xml
 rename master/bt5/slapos_category/PathTemplateItem/portal_categories/{allocation_scope/open/public.xml => trade_condition_type/compute_node.xml} (82%)
 rename master/bt5/slapos_category/PathTemplateItem/portal_categories/{allocation_scope/open/personal.xml => trade_condition_type/default.xml} (82%)
 create mode 100644 master/bt5/slapos_category/PathTemplateItem/portal_categories/trade_condition_type/deposit.xml
 create mode 100644 master/bt5/slapos_category/PathTemplateItem/portal_categories/trade_condition_type/instance_tree.xml
 create mode 100644 master/bt5/slapos_category/PathTemplateItem/portal_categories/trade_condition_type/virtual_master.xml
 create mode 100644 master/bt5/slapos_category/PathTemplateItem/portal_categories/use/trade/deposit.xml

diff --git a/master/bt5/slapos_category/PathTemplateItem/portal_categories/allocation_scope/open/subscription.xml b/master/bt5/slapos_category/PathTemplateItem/portal_categories/business_application/login.xml
similarity index 79%
rename from master/bt5/slapos_category/PathTemplateItem/portal_categories/allocation_scope/open/subscription.xml
rename to master/bt5/slapos_category/PathTemplateItem/portal_categories/business_application/login.xml
index 3fed20355..320c69bec 100644
--- a/master/bt5/slapos_category/PathTemplateItem/portal_categories/allocation_scope/open/subscription.xml
+++ b/master/bt5/slapos_category/PathTemplateItem/portal_categories/business_application/login.xml
@@ -56,22 +56,32 @@
         <item>
             <key> <string>categories</string> </key>
             <value>
-              <tuple/>
+              <tuple>
+                <string>business_application/base</string>
+              </tuple>
             </value>
         </item>
         <item>
-            <key> <string>description</string> </key>
-            <value> <string>Allocate services to anyone</string> </value>
+            <key> <string>codification</string> </key>
+            <value> <string>BA-LOGIN</string> </value>
+        </item>
+        <item>
+            <key> <string>default_reference</string> </key>
+            <value> <string>LOGIN</string> </value>
         </item>
         <item>
-            <key> <string>effective_date</string> </key>
+            <key> <string>description</string> </key>
             <value>
               <none/>
             </value>
         </item>
         <item>
             <key> <string>id</string> </key>
-            <value> <string>subscription</string> </value>
+            <value> <string>login</string> </value>
+        </item>
+        <item>
+            <key> <string>int_index</string> </key>
+            <value> <int>7</int> </value>
         </item>
         <item>
             <key> <string>portal_type</string> </key>
@@ -79,7 +89,7 @@
         </item>
         <item>
             <key> <string>title</string> </key>
-            <value> <string>Subscription</string> </value>
+            <value> <string>Login</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/master/bt5/slapos_category/PathTemplateItem/portal_categories/business_application/slapos.xml b/master/bt5/slapos_category/PathTemplateItem/portal_categories/business_application/slapos.xml
new file mode 100644
index 000000000..ffc11b75a
--- /dev/null
+++ b/master/bt5/slapos_category/PathTemplateItem/portal_categories/business_application/slapos.xml
@@ -0,0 +1,97 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="Category" module="erp5.portal_type"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_Add_portal_content_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignor</string>
+                <string>Manager</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>_Add_portal_folders_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignor</string>
+                <string>Manager</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>_Copy_or_Move_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignor</string>
+                <string>Manager</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>_Delete_objects_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignor</string>
+                <string>Manager</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>_Modify_portal_content_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignee</string>
+                <string>Assignor</string>
+                <string>Manager</string>
+                <string>Owner</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>categories</string> </key>
+            <value>
+              <tuple>
+                <string>business_application/base</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>codification</string> </key>
+            <value> <string>BA-SLAPOS</string> </value>
+        </item>
+        <item>
+            <key> <string>default_reference</string> </key>
+            <value> <string>SLAPOS</string> </value>
+        </item>
+        <item>
+            <key> <string>description</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>slapos</string> </value>
+        </item>
+        <item>
+            <key> <string>int_index</string> </key>
+            <value> <int>8</int> </value>
+        </item>
+        <item>
+            <key> <string>portal_type</string> </key>
+            <value> <string>Category</string> </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string>SlapOS</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/master/bt5/slapos_category/PathTemplateItem/portal_categories/ledger/automated.xml b/master/bt5/slapos_category/PathTemplateItem/portal_categories/ledger/automated.xml
new file mode 100644
index 000000000..94e3d7bb5
--- /dev/null
+++ b/master/bt5/slapos_category/PathTemplateItem/portal_categories/ledger/automated.xml
@@ -0,0 +1,117 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="Category" module="erp5.portal_type"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_Add_portal_content_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignor</string>
+                <string>Manager</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>_Add_portal_folders_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignor</string>
+                <string>Manager</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>_Copy_or_Move_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignor</string>
+                <string>Manager</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>_Delete_objects_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignor</string>
+                <string>Manager</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>_Modify_portal_content_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignee</string>
+                <string>Assignor</string>
+                <string>Manager</string>
+                <string>Owner</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>_count</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>_mt_index</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>_tree</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>description</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>automated</string> </value>
+        </item>
+        <item>
+            <key> <string>portal_type</string> </key>
+            <value> <string>Category</string> </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string>Automated</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="2" aka="AAAAAAAAAAI=">
+    <pickle>
+      <global name="Length" module="BTrees.Length"/>
+    </pickle>
+    <pickle> <int>0</int> </pickle>
+  </record>
+  <record id="3" aka="AAAAAAAAAAM=">
+    <pickle>
+      <global name="OOBTree" module="BTrees.OOBTree"/>
+    </pickle>
+    <pickle>
+      <none/>
+    </pickle>
+  </record>
+  <record id="4" aka="AAAAAAAAAAQ=">
+    <pickle>
+      <global name="OOBTree" module="BTrees.OOBTree"/>
+    </pickle>
+    <pickle>
+      <none/>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/master/bt5/slapos_category/PathTemplateItem/portal_categories/allocation_scope/open/public.xml b/master/bt5/slapos_category/PathTemplateItem/portal_categories/trade_condition_type/compute_node.xml
similarity index 82%
rename from master/bt5/slapos_category/PathTemplateItem/portal_categories/allocation_scope/open/public.xml
rename to master/bt5/slapos_category/PathTemplateItem/portal_categories/trade_condition_type/compute_node.xml
index 262917127..e2c161adc 100644
--- a/master/bt5/slapos_category/PathTemplateItem/portal_categories/allocation_scope/open/public.xml
+++ b/master/bt5/slapos_category/PathTemplateItem/portal_categories/trade_condition_type/compute_node.xml
@@ -55,25 +55,17 @@
         </item>
         <item>
             <key> <string>description</string> </key>
-            <value> <string>Allocate services to anyone</string> </value>
-        </item>
-        <item>
-            <key> <string>effective_date</string> </key>
             <value>
               <none/>
             </value>
         </item>
         <item>
             <key> <string>id</string> </key>
-            <value> <string>public</string> </value>
-        </item>
-        <item>
-            <key> <string>portal_type</string> </key>
-            <value> <string>Category</string> </value>
+            <value> <string>compute_node</string> </value>
         </item>
         <item>
             <key> <string>title</string> </key>
-            <value> <string>Public</string> </value>
+            <value> <string>Compute Node</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/master/bt5/slapos_category/PathTemplateItem/portal_categories/allocation_scope/open/personal.xml b/master/bt5/slapos_category/PathTemplateItem/portal_categories/trade_condition_type/default.xml
similarity index 82%
rename from master/bt5/slapos_category/PathTemplateItem/portal_categories/allocation_scope/open/personal.xml
rename to master/bt5/slapos_category/PathTemplateItem/portal_categories/trade_condition_type/default.xml
index b867ed4bb..d2f99ace5 100644
--- a/master/bt5/slapos_category/PathTemplateItem/portal_categories/allocation_scope/open/personal.xml
+++ b/master/bt5/slapos_category/PathTemplateItem/portal_categories/trade_condition_type/default.xml
@@ -55,25 +55,17 @@
         </item>
         <item>
             <key> <string>description</string> </key>
-            <value> <string>Allocate services for the owner of the compute_node</string> </value>
-        </item>
-        <item>
-            <key> <string>effective_date</string> </key>
             <value>
               <none/>
             </value>
         </item>
         <item>
             <key> <string>id</string> </key>
-            <value> <string>personal</string> </value>
-        </item>
-        <item>
-            <key> <string>portal_type</string> </key>
-            <value> <string>Category</string> </value>
+            <value> <string>default</string> </value>
         </item>
         <item>
             <key> <string>title</string> </key>
-            <value> <string>Personal</string> </value>
+            <value> <string>Default</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/master/bt5/slapos_category/PathTemplateItem/portal_categories/trade_condition_type/deposit.xml b/master/bt5/slapos_category/PathTemplateItem/portal_categories/trade_condition_type/deposit.xml
new file mode 100644
index 000000000..5a41035b0
--- /dev/null
+++ b/master/bt5/slapos_category/PathTemplateItem/portal_categories/trade_condition_type/deposit.xml
@@ -0,0 +1,73 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="Category" module="erp5.portal_type"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_Add_portal_content_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignor</string>
+                <string>Manager</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>_Add_portal_folders_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignor</string>
+                <string>Manager</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>_Copy_or_Move_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignor</string>
+                <string>Manager</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>_Delete_objects_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignor</string>
+                <string>Manager</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>_Modify_portal_content_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignee</string>
+                <string>Assignor</string>
+                <string>Manager</string>
+                <string>Owner</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>description</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>deposit</string> </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string>Deposit</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/master/bt5/slapos_category/PathTemplateItem/portal_categories/trade_condition_type/instance_tree.xml b/master/bt5/slapos_category/PathTemplateItem/portal_categories/trade_condition_type/instance_tree.xml
new file mode 100644
index 000000000..6fd733952
--- /dev/null
+++ b/master/bt5/slapos_category/PathTemplateItem/portal_categories/trade_condition_type/instance_tree.xml
@@ -0,0 +1,73 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="Category" module="erp5.portal_type"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_Add_portal_content_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignor</string>
+                <string>Manager</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>_Add_portal_folders_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignor</string>
+                <string>Manager</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>_Copy_or_Move_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignor</string>
+                <string>Manager</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>_Delete_objects_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignor</string>
+                <string>Manager</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>_Modify_portal_content_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignee</string>
+                <string>Assignor</string>
+                <string>Manager</string>
+                <string>Owner</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>description</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>instance_tree</string> </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string>Instance Tree</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/master/bt5/slapos_category/PathTemplateItem/portal_categories/trade_condition_type/virtual_master.xml b/master/bt5/slapos_category/PathTemplateItem/portal_categories/trade_condition_type/virtual_master.xml
new file mode 100644
index 000000000..8027ace42
--- /dev/null
+++ b/master/bt5/slapos_category/PathTemplateItem/portal_categories/trade_condition_type/virtual_master.xml
@@ -0,0 +1,73 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="Category" module="erp5.portal_type"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_Add_portal_content_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignor</string>
+                <string>Manager</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>_Add_portal_folders_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignor</string>
+                <string>Manager</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>_Copy_or_Move_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignor</string>
+                <string>Manager</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>_Delete_objects_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignor</string>
+                <string>Manager</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>_Modify_portal_content_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignee</string>
+                <string>Assignor</string>
+                <string>Manager</string>
+                <string>Owner</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>description</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>virtual_master</string> </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string>Virtual Master</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/master/bt5/slapos_category/PathTemplateItem/portal_categories/use/trade/deposit.xml b/master/bt5/slapos_category/PathTemplateItem/portal_categories/use/trade/deposit.xml
new file mode 100644
index 000000000..522810bf5
--- /dev/null
+++ b/master/bt5/slapos_category/PathTemplateItem/portal_categories/use/trade/deposit.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="Category" module="erp5.portal_type"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_Add_portal_content_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignor</string>
+                <string>Manager</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>_Add_portal_folders_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignor</string>
+                <string>Manager</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>_Copy_or_Move_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignor</string>
+                <string>Manager</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>_Delete_objects_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignor</string>
+                <string>Manager</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>_Modify_portal_content_Permission</string> </key>
+            <value>
+              <tuple>
+                <string>Assignee</string>
+                <string>Assignor</string>
+                <string>Manager</string>
+                <string>Owner</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>description</string> </key>
+            <value> <string>Deposit for trade operations</string> </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>deposit</string> </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string>Deposit</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/master/bt5/slapos_category/PathTemplateItem/portal_categories/use/trade/discount_service.xml b/master/bt5/slapos_category/PathTemplateItem/portal_categories/use/trade/discount_service.xml
index bc8381e51..14ff63fd6 100644
--- a/master/bt5/slapos_category/PathTemplateItem/portal_categories/use/trade/discount_service.xml
+++ b/master/bt5/slapos_category/PathTemplateItem/portal_categories/use/trade/discount_service.xml
@@ -67,7 +67,7 @@
         </item>
         <item>
             <key> <string>title</string> </key>
-            <value> <string>Discount</string> </value>
+            <value> <string>Discount Service</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/master/bt5/slapos_category/bt/template_path_list b/master/bt5/slapos_category/bt/template_path_list
index 0dbab54d9..b9101366e 100644
--- a/master/bt5/slapos_category/bt/template_path_list
+++ b/master/bt5/slapos_category/bt/template_path_list
@@ -47,6 +47,7 @@ portal_categories/group/rackspace
 portal_categories/group/vifib
 portal_categories/group/vmware
 portal_categories/incoterm/**
+portal_categories/ledger/**
 portal_categories/local_area_network_type/**
 portal_categories/marital_status/**
 portal_categories/market_segment/**
@@ -73,6 +74,7 @@ portal_categories/storage_capacity/**
 portal_categories/storage_interface/**
 portal_categories/storage_redundancy/**
 portal_categories/storage_technology/**
+portal_categories/trade_condition_type/**
 portal_categories/use/calendar
 portal_categories/use/calendar/**
 portal_categories/use/crm
-- 
2.30.9