From 59baae20cb31a28b7450486d89cd87b8f7223eab Mon Sep 17 00:00:00 2001
From: Xiaowu Zhang <xiaowu.zhang@nexedi.com>
Date: Wed, 10 Jun 2020 08:54:48 +0000
Subject: [PATCH] erp5_project: avoid can't access error when get contents

if such error occurs, this listfield show "You selected an item that was not in list" error message when save
---
 .../my_destination_payment.xml                           | 9 +++------
 .../Base_viewProjectFieldLibrary/my_source_payment.xml   | 9 +++------
 2 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Base_viewProjectFieldLibrary/my_destination_payment.xml b/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Base_viewProjectFieldLibrary/my_destination_payment.xml
index d07c12b582..0a5543dbd0 100644
--- a/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Base_viewProjectFieldLibrary/my_destination_payment.xml
+++ b/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Base_viewProjectFieldLibrary/my_destination_payment.xml
@@ -10,9 +10,9 @@
             <key> <string>delegated_list</string> </key>
             <value>
               <list>
-                <string>title</string>
                 <string>description</string>
                 <string>items</string>
+                <string>title</string>
               </list>
             </value>
         </item>
@@ -121,16 +121,13 @@
   </record>
   <record id="2" aka="AAAAAAAAAAI=">
     <pickle>
-      <tuple>
-        <global name="TALESMethod" module="Products.Formulator.TALESField"/>
-        <tuple/>
-      </tuple>
+      <global name="TALESMethod" module="Products.Formulator.TALESField"/>
     </pickle>
     <pickle>
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python:[(\'\', \'\')] + (here.getDestinationSection() and [(x.Title(), x.getRelativeUrl()) for x in here.getDestinationSectionValue().objectValues(portal_type = here.getPortalPaymentNodeTypeList())] or [])</string> </value>
+            <value> <string>python:[(\'\', \'\')] + (here.getDestinationSection() and [(x.Title(), x.getRelativeUrl()) for x in here.getDestinationSectionValue().objectValues(portal_type = here.getPortalPaymentNodeTypeList(), checked_permission=\'View\')] or [])</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Base_viewProjectFieldLibrary/my_source_payment.xml b/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Base_viewProjectFieldLibrary/my_source_payment.xml
index caa3a741b2..f3024a4e40 100644
--- a/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Base_viewProjectFieldLibrary/my_source_payment.xml
+++ b/bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Base_viewProjectFieldLibrary/my_source_payment.xml
@@ -10,9 +10,9 @@
             <key> <string>delegated_list</string> </key>
             <value>
               <list>
-                <string>title</string>
                 <string>description</string>
                 <string>items</string>
+                <string>title</string>
               </list>
             </value>
         </item>
@@ -121,16 +121,13 @@
   </record>
   <record id="2" aka="AAAAAAAAAAI=">
     <pickle>
-      <tuple>
-        <global name="TALESMethod" module="Products.Formulator.TALESField"/>
-        <tuple/>
-      </tuple>
+      <global name="TALESMethod" module="Products.Formulator.TALESField"/>
     </pickle>
     <pickle>
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python:[(\'\', \'\')] + (here.getSourceSection() and [(x.Title(), x.getRelativeUrl()) for x in here.getSourceSectionValue().objectValues(portal_type = here.getPortalPaymentNodeTypeList())] or [])</string> </value>
+            <value> <string>python:[(\'\', \'\')] + (here.getSourceSection() and [(x.Title(), x.getRelativeUrl()) for x in here.getSourceSectionValue().objectValues(portal_type = here.getPortalPaymentNodeTypeList(),checked_permission=\'View\')] or [])</string> </value>
         </item>
       </dictionary>
     </pickle>
-- 
2.30.9