From bf57228a93f5cb69a1f93cc4fa5c02a98bb94872 Mon Sep 17 00:00:00 2001
From: Romain Courteaud <romain@nexedi.com>
Date: Wed, 9 May 2018 16:32:34 +0200
Subject: [PATCH] [erp5_core] RelationField listbox must also fetch
 default_params value from the relationfield

---
 .../Base_viewRelatedObjectList/listbox.xml    | 52 ++++++++++++++-----
 1 file changed, 39 insertions(+), 13 deletions(-)

diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_viewRelatedObjectList/listbox.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_viewRelatedObjectList/listbox.xml
index 5e66f3eaec..6e8e13ca98 100644
--- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_viewRelatedObjectList/listbox.xml
+++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_viewRelatedObjectList/listbox.xml
@@ -11,6 +11,7 @@
             <value>
               <list>
                 <string>count_method</string>
+                <string>default_params</string>
                 <string>list_action</string>
                 <string>list_method</string>
                 <string>portal_types</string>
@@ -66,17 +67,23 @@
                     <value> <string></string> </value>
                 </item>
                 <item>
-                    <key> <string>field_id</string> </key>
+                    <key> <string>default_params</string> </key>
                     <value>
                       <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
                     </value>
                 </item>
                 <item>
-                    <key> <string>form_id</string> </key>
+                    <key> <string>field_id</string> </key>
                     <value>
                       <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
                     </value>
                 </item>
+                <item>
+                    <key> <string>form_id</string> </key>
+                    <value>
+                      <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
+                    </value>
+                </item>
                 <item>
                     <key> <string>list_action</string> </key>
                     <value> <string></string> </value>
@@ -88,7 +95,7 @@
                 <item>
                     <key> <string>portal_types</string> </key>
                     <value>
-                      <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
+                      <persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
                     </value>
                 </item>
                 <item>
@@ -106,7 +113,7 @@
                 <item>
                     <key> <string>sort</string> </key>
                     <value>
-                      <persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
+                      <persistent> <string encoding="base64">AAAAAAAAAAY=</string> </persistent>
                     </value>
                 </item>
                 <item>
@@ -120,7 +127,7 @@
                 <item>
                     <key> <string>title</string> </key>
                     <value>
-                      <persistent> <string encoding="base64">AAAAAAAAAAY=</string> </persistent>
+                      <persistent> <string encoding="base64">AAAAAAAAAAc=</string> </persistent>
                     </value>
                 </item>
               </dictionary>
@@ -143,7 +150,13 @@
                 <item>
                     <key> <string>count_method</string> </key>
                     <value>
-                      <persistent> <string encoding="base64">AAAAAAAAAAc=</string> </persistent>
+                      <persistent> <string encoding="base64">AAAAAAAAAAg=</string> </persistent>
+                    </value>
+                </item>
+                <item>
+                    <key> <string>default_params</string> </key>
+                    <value>
+                      <list/>
                     </value>
                 </item>
                 <item>
@@ -169,7 +182,7 @@
                 <item>
                     <key> <string>list_method</string> </key>
                     <value>
-                      <persistent> <string encoding="base64">AAAAAAAAAAg=</string> </persistent>
+                      <persistent> <string encoding="base64">AAAAAAAAAAk=</string> </persistent>
                     </value>
                 </item>
                 <item>
@@ -232,7 +245,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python: context.Base_getRelationFieldProxyListBoxId().split("/")[1]</string> </value>
+            <value> <string>python: here.Base_getRelatedObjectParameter(parameter=\'parameter_list\')</string> </value>
         </item>
       </dictionary>
     </pickle>
@@ -245,7 +258,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python: context.Base_getRelationFieldProxyListBoxId().split("/")[0]</string> </value>
+            <value> <string>python: context.Base_getRelationFieldProxyListBoxId().split("/")[1]</string> </value>
         </item>
       </dictionary>
     </pickle>
@@ -258,7 +271,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python: here.Base_getRelatedObjectParameter(parameter=\'portal_type\')</string> </value>
+            <value> <string>python: context.Base_getRelationFieldProxyListBoxId().split("/")[0]</string> </value>
         </item>
       </dictionary>
     </pickle>
@@ -271,7 +284,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python: here.Base_getRelatedObjectParameter(parameter=\'sort\')</string> </value>
+            <value> <string>python: here.Base_getRelatedObjectParameter(parameter=\'portal_type\')</string> </value>
         </item>
       </dictionary>
     </pickle>
@@ -284,12 +297,25 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python: here.Base_getRelatedObjectParameter(parameter=\'title\')</string> </value>
+            <value> <string>python: here.Base_getRelatedObjectParameter(parameter=\'sort\')</string> </value>
         </item>
       </dictionary>
     </pickle>
   </record>
   <record id="7" aka="AAAAAAAAAAc=">
+    <pickle>
+      <global name="TALESMethod" module="Products.Formulator.TALESField"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_text</string> </key>
+            <value> <string>python: here.Base_getRelatedObjectParameter(parameter=\'title\')</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="8" aka="AAAAAAAAAAg=">
     <pickle>
       <global name="Method" module="Products.Formulator.MethodField"/>
     </pickle>
@@ -302,7 +328,7 @@
       </dictionary>
     </pickle>
   </record>
-  <record id="8" aka="AAAAAAAAAAg=">
+  <record id="9" aka="AAAAAAAAAAk=">
     <pickle>
       <global name="Method" module="Products.Formulator.MethodField"/>
     </pickle>
-- 
2.30.9