From e9c30e750d49aaf0d5a591c169a26fc43409e390 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Thu, 9 Dec 2010 17:49:00 +0000
Subject: [PATCH] Repair dialog to select / create items. Quantity vs Expected
 quantities should not be editable. Also only show this on delivery lines
 (because order does not have simulation to be compared against)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41292 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../matrixbox.xml                             | 27 ++++++++++++++++-
 .../your_simulation_quantity.xml              | 29 ++++++++++++++-----
 .../matrixbox.xml                             | 27 ++++++++++++++++-
 .../my_simulation_quantity.xml                | 29 ++++++++++++++-----
 .../my_total_quantity.xml                     | 29 ++++++++++++++-----
 bt5/erp5_item/bt/revision                     |  2 +-
 6 files changed, 116 insertions(+), 27 deletions(-)

diff --git a/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item_trade/DeliveryLine_viewItemCreationDialog/matrixbox.xml b/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item_trade/DeliveryLine_viewItemCreationDialog/matrixbox.xml
index a4b75382cd..af89851180 100644
--- a/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item_trade/DeliveryLine_viewItemCreationDialog/matrixbox.xml
+++ b/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item_trade/DeliveryLine_viewItemCreationDialog/matrixbox.xml
@@ -9,7 +9,9 @@
         <item>
             <key> <string>delegated_list</string> </key>
             <value>
-              <list/>
+              <list>
+                <string>enabled</string>
+              </list>
             </value>
         </item>
         <item>
@@ -50,6 +52,12 @@
             <key> <string>tales</string> </key>
             <value>
               <dictionary>
+                <item>
+                    <key> <string>enabled</string> </key>
+                    <value>
+                      <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+                    </value>
+                </item>
                 <item>
                     <key> <string>field_id</string> </key>
                     <value> <string></string> </value>
@@ -69,6 +77,10 @@
             <key> <string>values</string> </key>
             <value>
               <dictionary>
+                <item>
+                    <key> <string>enabled</string> </key>
+                    <value> <int>1</int> </value>
+                </item>
                 <item>
                     <key> <string>field_id</string> </key>
                     <value> <string>my_dialog_mode_matrixbox</string> </value>
@@ -87,4 +99,17 @@
       </dictionary>
     </pickle>
   </record>
+  <record id="2" aka="AAAAAAAAAAI=">
+    <pickle>
+      <global name="TALESMethod" module="Products.Formulator.TALESField"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_text</string> </key>
+            <value> <string>python: not context.isMovement() and context.getPortalType() in context.getPortalDeliveryTypeList()</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
 </ZopeData>
diff --git a/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item_trade/DeliveryLine_viewItemCreationDialog/your_simulation_quantity.xml b/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item_trade/DeliveryLine_viewItemCreationDialog/your_simulation_quantity.xml
index d4f394ebdc..0d40a56b74 100644
--- a/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item_trade/DeliveryLine_viewItemCreationDialog/your_simulation_quantity.xml
+++ b/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item_trade/DeliveryLine_viewItemCreationDialog/your_simulation_quantity.xml
@@ -10,7 +10,8 @@
             <key> <string>delegated_list</string> </key>
             <value>
               <list>
-                <string>input_style</string>
+                <string>editable</string>
+                <string>enabled</string>
               </list>
             </value>
         </item>
@@ -53,19 +54,23 @@
             <value>
               <dictionary>
                 <item>
-                    <key> <string>field_id</string> </key>
-                    <value> <string></string> </value>
-                </item>
-                <item>
-                    <key> <string>form_id</string> </key>
+                    <key> <string>editable</string> </key>
                     <value> <string></string> </value>
                 </item>
                 <item>
-                    <key> <string>input_style</string> </key>
+                    <key> <string>enabled</string> </key>
                     <value>
                       <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
                     </value>
                 </item>
+                <item>
+                    <key> <string>field_id</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>form_id</string> </key>
+                    <value> <string></string> </value>
+                </item>
                 <item>
                     <key> <string>target</string> </key>
                     <value> <string></string> </value>
@@ -77,6 +82,14 @@
             <key> <string>values</string> </key>
             <value>
               <dictionary>
+                <item>
+                    <key> <string>editable</string> </key>
+                    <value> <int>0</int> </value>
+                </item>
+                <item>
+                    <key> <string>enabled</string> </key>
+                    <value> <int>1</int> </value>
+                </item>
                 <item>
                     <key> <string>field_id</string> </key>
                     <value> <string>my_dialog_mode_simulation_quantity</string> </value>
@@ -103,7 +116,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python: preferences.getPreference(\'preferred_float_number_style\', \'-1 234.5\')</string> </value>
+            <value> <string>python: context.isMovement() and context.getPortalType() in context.getPortalDeliveryTypeList()</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item_trade/DeliveryLine_viewSelectItemListDialog/matrixbox.xml b/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item_trade/DeliveryLine_viewSelectItemListDialog/matrixbox.xml
index a4b75382cd..af89851180 100644
--- a/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item_trade/DeliveryLine_viewSelectItemListDialog/matrixbox.xml
+++ b/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item_trade/DeliveryLine_viewSelectItemListDialog/matrixbox.xml
@@ -9,7 +9,9 @@
         <item>
             <key> <string>delegated_list</string> </key>
             <value>
-              <list/>
+              <list>
+                <string>enabled</string>
+              </list>
             </value>
         </item>
         <item>
@@ -50,6 +52,12 @@
             <key> <string>tales</string> </key>
             <value>
               <dictionary>
+                <item>
+                    <key> <string>enabled</string> </key>
+                    <value>
+                      <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+                    </value>
+                </item>
                 <item>
                     <key> <string>field_id</string> </key>
                     <value> <string></string> </value>
@@ -69,6 +77,10 @@
             <key> <string>values</string> </key>
             <value>
               <dictionary>
+                <item>
+                    <key> <string>enabled</string> </key>
+                    <value> <int>1</int> </value>
+                </item>
                 <item>
                     <key> <string>field_id</string> </key>
                     <value> <string>my_dialog_mode_matrixbox</string> </value>
@@ -87,4 +99,17 @@
       </dictionary>
     </pickle>
   </record>
+  <record id="2" aka="AAAAAAAAAAI=">
+    <pickle>
+      <global name="TALESMethod" module="Products.Formulator.TALESField"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_text</string> </key>
+            <value> <string>python: not context.isMovement() and context.getPortalType() in context.getPortalDeliveryTypeList()</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
 </ZopeData>
diff --git a/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item_trade/DeliveryLine_viewSelectItemListDialog/my_simulation_quantity.xml b/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item_trade/DeliveryLine_viewSelectItemListDialog/my_simulation_quantity.xml
index 322d1da101..61be324998 100644
--- a/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item_trade/DeliveryLine_viewSelectItemListDialog/my_simulation_quantity.xml
+++ b/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item_trade/DeliveryLine_viewSelectItemListDialog/my_simulation_quantity.xml
@@ -10,7 +10,8 @@
             <key> <string>delegated_list</string> </key>
             <value>
               <list>
-                <string>input_style</string>
+                <string>editable</string>
+                <string>enabled</string>
               </list>
             </value>
         </item>
@@ -53,19 +54,23 @@
             <value>
               <dictionary>
                 <item>
-                    <key> <string>field_id</string> </key>
-                    <value> <string></string> </value>
-                </item>
-                <item>
-                    <key> <string>form_id</string> </key>
+                    <key> <string>editable</string> </key>
                     <value> <string></string> </value>
                 </item>
                 <item>
-                    <key> <string>input_style</string> </key>
+                    <key> <string>enabled</string> </key>
                     <value>
                       <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
                     </value>
                 </item>
+                <item>
+                    <key> <string>field_id</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>form_id</string> </key>
+                    <value> <string></string> </value>
+                </item>
                 <item>
                     <key> <string>target</string> </key>
                     <value> <string></string> </value>
@@ -77,6 +82,14 @@
             <key> <string>values</string> </key>
             <value>
               <dictionary>
+                <item>
+                    <key> <string>editable</string> </key>
+                    <value> <int>0</int> </value>
+                </item>
+                <item>
+                    <key> <string>enabled</string> </key>
+                    <value> <int>0</int> </value>
+                </item>
                 <item>
                     <key> <string>field_id</string> </key>
                     <value> <string>my_dialog_mode_simulation_quantity</string> </value>
@@ -103,7 +116,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python: preferences.getPreference(\'preferred_float_number_style\', \'-1 234.5\')</string> </value>
+            <value> <string>python: context.isMovement() and context.getPortalType() in context.getPortalDeliveryTypeList()</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item_trade/DeliveryLine_viewSelectItemListDialog/my_total_quantity.xml b/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item_trade/DeliveryLine_viewSelectItemListDialog/my_total_quantity.xml
index efb7aacfc8..2a5aec32a1 100644
--- a/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item_trade/DeliveryLine_viewSelectItemListDialog/my_total_quantity.xml
+++ b/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item_trade/DeliveryLine_viewSelectItemListDialog/my_total_quantity.xml
@@ -10,7 +10,8 @@
             <key> <string>delegated_list</string> </key>
             <value>
               <list>
-                <string>input_style</string>
+                <string>editable</string>
+                <string>enabled</string>
               </list>
             </value>
         </item>
@@ -53,19 +54,23 @@
             <value>
               <dictionary>
                 <item>
-                    <key> <string>field_id</string> </key>
-                    <value> <string></string> </value>
-                </item>
-                <item>
-                    <key> <string>form_id</string> </key>
+                    <key> <string>editable</string> </key>
                     <value> <string></string> </value>
                 </item>
                 <item>
-                    <key> <string>input_style</string> </key>
+                    <key> <string>enabled</string> </key>
                     <value>
                       <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
                     </value>
                 </item>
+                <item>
+                    <key> <string>field_id</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>form_id</string> </key>
+                    <value> <string></string> </value>
+                </item>
                 <item>
                     <key> <string>target</string> </key>
                     <value> <string></string> </value>
@@ -77,6 +82,14 @@
             <key> <string>values</string> </key>
             <value>
               <dictionary>
+                <item>
+                    <key> <string>editable</string> </key>
+                    <value> <int>0</int> </value>
+                </item>
+                <item>
+                    <key> <string>enabled</string> </key>
+                    <value> <int>1</int> </value>
+                </item>
                 <item>
                     <key> <string>field_id</string> </key>
                     <value> <string>my_dialog_mode_total_quantity</string> </value>
@@ -103,7 +116,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>python: preferences.getPreference(\'preferred_float_number_style\', \'-1 234.5\')</string> </value>
+            <value> <string>python: context.isMovement() and context.getPortalType() in context.getPortalDeliveryTypeList()</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/bt5/erp5_item/bt/revision b/bt5/erp5_item/bt/revision
index b6e27607fb..d3b9819557 100644
--- a/bt5/erp5_item/bt/revision
+++ b/bt5/erp5_item/bt/revision
@@ -1 +1 @@
-242
\ No newline at end of file
+246
\ No newline at end of file
-- 
2.30.9