From a409a7e605eae96518453526f676877365817fb1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Tue, 2 Dec 2008 10:25:34 +0000
Subject: [PATCH] Fix jump action by using Base_jumpToRelatedObject to jump and
 Base_checkPermission to check that the destination module is visible

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24760 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../Organisation/jump_to_purchase_order.xml   |  4 +--
 .../jump_to_purchase_packing_list.xml         | 34 +++++--------------
 .../Organisation/jump_to_sale_order.xml       |  4 +--
 .../jump_to_sale_packing_list.xml             |  4 +--
 .../Person/jump_to_purchase_order.xml         | 26 ++++++++++++--
 .../Person/jump_to_purchase_packing_list.xml  | 26 ++++++++++++--
 .../Person/jump_to_sale_order.xml             | 26 ++++++++++++--
 .../Person/jump_to_sale_packing_list.xml      | 26 ++++++++++++--
 bt5/erp5_trade/bt/revision                    |  2 +-
 9 files changed, 111 insertions(+), 41 deletions(-)

diff --git a/bt5/erp5_trade/ActionTemplateItem/portal_types/Organisation/jump_to_purchase_order.xml b/bt5/erp5_trade/ActionTemplateItem/portal_types/Organisation/jump_to_purchase_order.xml
index b5acb305e5..ceb8525101 100644
--- a/bt5/erp5_trade/ActionTemplateItem/portal_types/Organisation/jump_to_purchase_order.xml
+++ b/bt5/erp5_trade/ActionTemplateItem/portal_types/Organisation/jump_to_purchase_order.xml
@@ -73,7 +73,7 @@
             <key> <string>text</string> </key>
             <value> <string encoding="cdata"><![CDATA[
 
-string:${portal_url}/purchase_order_module/view?reset:int=1&default_source_title=${object/getTitle}
+string:${object_url}/Base_jumpToRelatedObject?base_category=source&portal_type=Purchase+Order
 
 ]]></string> </value>
         </item>
@@ -91,7 +91,7 @@ string:${portal_url}/purchase_order_module/view?reset:int=1&default_source_title
       <dictionary>
         <item>
             <key> <string>text</string> </key>
-            <value> <string>python:portal.restrictedTraverse(\'purchase_order_module\', None) is not None</string> </value>
+            <value> <string>python: portal.Base_checkPermission(\'purchase_order_module\', \'View\')</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_trade/ActionTemplateItem/portal_types/Organisation/jump_to_purchase_packing_list.xml b/bt5/erp5_trade/ActionTemplateItem/portal_types/Organisation/jump_to_purchase_packing_list.xml
index dab48dd885..7adbd0b711 100644
--- a/bt5/erp5_trade/ActionTemplateItem/portal_types/Organisation/jump_to_purchase_packing_list.xml
+++ b/bt5/erp5_trade/ActionTemplateItem/portal_types/Organisation/jump_to_purchase_packing_list.xml
@@ -11,9 +11,7 @@
       <dictionary>
         <item>
             <key> <string>action</string> </key>
-            <value>
-              <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
-            </value>
+            <value> <string></string> </value>
         </item>
         <item>
             <key> <string>category</string> </key>
@@ -22,12 +20,16 @@
         <item>
             <key> <string>condition</string> </key>
             <value>
-              <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
+              <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
             </value>
         </item>
         <item>
             <key> <string>description</string> </key>
-            <value> <string></string> </value>
+            <value> <string encoding="cdata"><![CDATA[
+
+string:${object_url}/Base_jumpToRelatedObject?base_category=source&portal_type=Purchase+Packing+List
+
+]]></string> </value>
         </item>
         <item>
             <key> <string>icon</string> </key>
@@ -71,27 +73,7 @@
       <dictionary>
         <item>
             <key> <string>text</string> </key>
-            <value> <string encoding="cdata"><![CDATA[
-
-string:${portal_url}/purchase_packing_list_module/view?reset:int=1&default_source_title=${object/getTitle}
-
-]]></string> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-  <record id="3" aka="AAAAAAAAAAM=">
-    <pickle>
-      <tuple>
-        <global name="Expression" module="Products.CMFCore.Expression"/>
-        <tuple/>
-      </tuple>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>text</string> </key>
-            <value> <string>python:portal.restrictedTraverse(\'purchase_packing_list_module\', None) is not None</string> </value>
+            <value> <string>python: portal.Base_checkPermission(\'purchase_packing_list_module\', \'View\')</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_trade/ActionTemplateItem/portal_types/Organisation/jump_to_sale_order.xml b/bt5/erp5_trade/ActionTemplateItem/portal_types/Organisation/jump_to_sale_order.xml
index b7ef7c52d4..233336209b 100644
--- a/bt5/erp5_trade/ActionTemplateItem/portal_types/Organisation/jump_to_sale_order.xml
+++ b/bt5/erp5_trade/ActionTemplateItem/portal_types/Organisation/jump_to_sale_order.xml
@@ -73,7 +73,7 @@
             <key> <string>text</string> </key>
             <value> <string encoding="cdata"><![CDATA[
 
-string:${portal_url}/sale_order_module/view?reset:int=1&default_destination_title=${object/getTitle}
+string:${object_url}/Base_jumpToRelatedObject?base_category=destination&portal_type=Sale+Order
 
 ]]></string> </value>
         </item>
@@ -91,7 +91,7 @@ string:${portal_url}/sale_order_module/view?reset:int=1&default_destination_titl
       <dictionary>
         <item>
             <key> <string>text</string> </key>
-            <value> <string>python:portal.restrictedTraverse(\'sale_order_module\', None) is not None</string> </value>
+            <value> <string>python: portal.Base_checkPermission(\'sale_order_module\', \'View\')</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_trade/ActionTemplateItem/portal_types/Organisation/jump_to_sale_packing_list.xml b/bt5/erp5_trade/ActionTemplateItem/portal_types/Organisation/jump_to_sale_packing_list.xml
index 38ff59e595..46b29b2c16 100644
--- a/bt5/erp5_trade/ActionTemplateItem/portal_types/Organisation/jump_to_sale_packing_list.xml
+++ b/bt5/erp5_trade/ActionTemplateItem/portal_types/Organisation/jump_to_sale_packing_list.xml
@@ -73,7 +73,7 @@
             <key> <string>text</string> </key>
             <value> <string encoding="cdata"><![CDATA[
 
-string:${portal_url}/sale_packing_list_module/view?reset:int=1&default_destination_title=${object/getTitle}
+string:${object_url}/Base_jumpToRelatedObject?base_category=destination&portal_type=Sale+Packing+List
 
 ]]></string> </value>
         </item>
@@ -91,7 +91,7 @@ string:${portal_url}/sale_packing_list_module/view?reset:int=1&default_destinati
       <dictionary>
         <item>
             <key> <string>text</string> </key>
-            <value> <string>python:portal.restrictedTraverse(\'sale_packing_list_module\', None) is not None</string> </value>
+            <value> <string>python: portal.Base_checkPermission(\'sale_packing_list_module\', \'View\')</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_trade/ActionTemplateItem/portal_types/Person/jump_to_purchase_order.xml b/bt5/erp5_trade/ActionTemplateItem/portal_types/Person/jump_to_purchase_order.xml
index 8e4ad68a53..7da95d7072 100644
--- a/bt5/erp5_trade/ActionTemplateItem/portal_types/Person/jump_to_purchase_order.xml
+++ b/bt5/erp5_trade/ActionTemplateItem/portal_types/Person/jump_to_purchase_order.xml
@@ -21,7 +21,9 @@
         </item>
         <item>
             <key> <string>condition</string> </key>
-            <value> <string></string> </value>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
+            </value>
         </item>
         <item>
             <key> <string>description</string> </key>
@@ -69,7 +71,27 @@
       <dictionary>
         <item>
             <key> <string>text</string> </key>
-            <value> <string>string:${portal_url}/purchase_order_module/view</string> </value>
+            <value> <string encoding="cdata"><![CDATA[
+
+string:${object_url}/Base_jumpToRelatedObject?base_category=source&portal_type=Purchase+Order
+
+]]></string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="3" aka="AAAAAAAAAAM=">
+    <pickle>
+      <tuple>
+        <global name="Expression" module="Products.CMFCore.Expression"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>text</string> </key>
+            <value> <string>python: portal.Base_checkPermission(\'purchase_order_module\', \'View\')</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_trade/ActionTemplateItem/portal_types/Person/jump_to_purchase_packing_list.xml b/bt5/erp5_trade/ActionTemplateItem/portal_types/Person/jump_to_purchase_packing_list.xml
index e12d5677a7..d7954d994b 100644
--- a/bt5/erp5_trade/ActionTemplateItem/portal_types/Person/jump_to_purchase_packing_list.xml
+++ b/bt5/erp5_trade/ActionTemplateItem/portal_types/Person/jump_to_purchase_packing_list.xml
@@ -21,7 +21,9 @@
         </item>
         <item>
             <key> <string>condition</string> </key>
-            <value> <string></string> </value>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
+            </value>
         </item>
         <item>
             <key> <string>description</string> </key>
@@ -69,7 +71,27 @@
       <dictionary>
         <item>
             <key> <string>text</string> </key>
-            <value> <string>string:${portal_url}/purchase_packing_list_module/view</string> </value>
+            <value> <string encoding="cdata"><![CDATA[
+
+string:${object_url}/Base_jumpToRelatedObject?base_category=source&portal_type=Purchase+Packing+List
+
+]]></string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="3" aka="AAAAAAAAAAM=">
+    <pickle>
+      <tuple>
+        <global name="Expression" module="Products.CMFCore.Expression"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>text</string> </key>
+            <value> <string>python: portal.Base_checkPermission(\'purchase_packing_list_module\', \'View\')</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_trade/ActionTemplateItem/portal_types/Person/jump_to_sale_order.xml b/bt5/erp5_trade/ActionTemplateItem/portal_types/Person/jump_to_sale_order.xml
index fa3dac6324..3bb789cc2a 100644
--- a/bt5/erp5_trade/ActionTemplateItem/portal_types/Person/jump_to_sale_order.xml
+++ b/bt5/erp5_trade/ActionTemplateItem/portal_types/Person/jump_to_sale_order.xml
@@ -21,7 +21,9 @@
         </item>
         <item>
             <key> <string>condition</string> </key>
-            <value> <string></string> </value>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
+            </value>
         </item>
         <item>
             <key> <string>description</string> </key>
@@ -69,7 +71,27 @@
       <dictionary>
         <item>
             <key> <string>text</string> </key>
-            <value> <string>string:${portal_url}/sale_order_module/view</string> </value>
+            <value> <string encoding="cdata"><![CDATA[
+
+string:${object_url}/Base_jumpToRelatedObject?base_category=destination&portal_type=Sale+Order
+
+]]></string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="3" aka="AAAAAAAAAAM=">
+    <pickle>
+      <tuple>
+        <global name="Expression" module="Products.CMFCore.Expression"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>text</string> </key>
+            <value> <string>python: portal.Base_checkPermission(\'sale_order_module\', \'View\')</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_trade/ActionTemplateItem/portal_types/Person/jump_to_sale_packing_list.xml b/bt5/erp5_trade/ActionTemplateItem/portal_types/Person/jump_to_sale_packing_list.xml
index 7970892e92..3cd9a81c3e 100644
--- a/bt5/erp5_trade/ActionTemplateItem/portal_types/Person/jump_to_sale_packing_list.xml
+++ b/bt5/erp5_trade/ActionTemplateItem/portal_types/Person/jump_to_sale_packing_list.xml
@@ -21,7 +21,9 @@
         </item>
         <item>
             <key> <string>condition</string> </key>
-            <value> <string></string> </value>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
+            </value>
         </item>
         <item>
             <key> <string>description</string> </key>
@@ -69,7 +71,27 @@
       <dictionary>
         <item>
             <key> <string>text</string> </key>
-            <value> <string>string:${portal_url}/sale_packing_list_module/view</string> </value>
+            <value> <string encoding="cdata"><![CDATA[
+
+string:${object_url}/Base_jumpToRelatedObject?base_category=destination&portal_type=Sale+Packing+List
+
+]]></string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="3" aka="AAAAAAAAAAM=">
+    <pickle>
+      <tuple>
+        <global name="Expression" module="Products.CMFCore.Expression"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>text</string> </key>
+            <value> <string>python: portal.Base_checkPermission(\'sale_packing_list_module\', \'View\')</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_trade/bt/revision b/bt5/erp5_trade/bt/revision
index 40ca05e7ba..b18fcc5ba2 100644
--- a/bt5/erp5_trade/bt/revision
+++ b/bt5/erp5_trade/bt/revision
@@ -1 +1 @@
-534
\ No newline at end of file
+535
\ No newline at end of file
-- 
2.30.9