[Erp5-report] r39971 nicolas - in /erp5/trunk/bt5/erp5_trade: SkinTemplateItem/portal_skins...

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Nov 5 17:15:22 CET 2010


Author: nicolas
Date: Fri Nov  5 17:15:20 2010
New Revision: 39971

URL: http://svn.erp5.org?rev=39971&view=rev
Log:
Move out consistency checkings required by fast input from listMethod script of listbox.
Because HTTP redirection is not working during listbox rendering.

Create new script to check consistency of Deliveries which return fast input if checking pass.
Otherwise redirect the user to the Delivery with alert message.

Added:
    erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Delivery_checkConsistencyForDeliveryFastInputDialog.xml
Modified:
    erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Delivery_getFastInputLineList.xml
    erp5/trunk/bt5/erp5_trade/bt/revision

Added: erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Delivery_checkConsistencyForDeliveryFastInputDialog.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Delivery_checkConsistencyForDeliveryFastInputDialog.xml?rev=39971&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Delivery_checkConsistencyForDeliveryFastInputDialog.xml (added)
+++ erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Delivery_checkConsistencyForDeliveryFastInputDialog.xml [utf8] Fri Nov  5 17:15:20 2010
@@ -0,0 +1,175 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>Script_magic</string> </key>
+            <value> <int>3</int> </value>
+        </item>
+        <item>
+            <key> <string>_bind_names</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>_asgns</string> </key>
+                        <value>
+                          <dictionary>
+                            <item>
+                                <key> <string>name_container</string> </key>
+                                <value> <string>container</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_context</string> </key>
+                                <value> <string>context</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_m_self</string> </key>
+                                <value> <string>script</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_subpath</string> </key>
+                                <value> <string>traverse_subpath</string> </value>
+                            </item>
+                          </dictionary>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>_body</string> </key>
+            <value> <string>"""This script check that values fit fast input requirements.\n
+If validation succeeds, then form_dialog is returned.\n
+Otherwise a message is displayed to the user.\n
+"""\n
+portal = context.getPortalObject()\n
+# Retrieve lines portal type\n
+line_portal_type_list = [x for x in context.getTypeInfo().getTypeAllowedContentTypeList() \\\n
+                         if x in portal.getPortalMovementTypeList()]\n
+line_portal_type = line_portal_type_list[0]\n
+\n
+use_list = []\n
+# Check if the section and use preference are defined\n
+if line_portal_type in context.getPortalSaleTypeList():\n
+  section_uid = context.getSourceSectionUid()\n
+  use_list = portal.portal_preferences.getPreferredSaleUseList()\n
+elif line_portal_type in portal.getPortalPurchaseTypeList():\n
+  section_uid = context.getDestinationSectionUid()\n
+  use_list = portal.portal_preferences.getPreferredPurchaseUseList()\n
+elif line_portal_type in portal.getPortalInternalTypeList() + portal.getPortalInventoryMovementTypeList():\n
+  section_uid = ""\n
+  use_list = portal.portal_preferences.getPreferredPurchaseUseList() + \\\n
+             portal.portal_preferences.getPreferredSaleUseList()\n
+else:\n
+  from Products.ERP5Type.Message import translateString\n
+  return context.Base_redirect(\'view\', keep_items=dict(\n
+    portal_status_message=translateString(\'Type of document not known to retrieve section.\')))\n
+\n
+if len(use_list) == 0:\n
+  from Products.ERP5Type.Message import translateString\n
+  return context.Base_redirect(\'view\', keep_items=dict(\n
+    portal_status_message=translateString(\'Use preference must be defined.\')))\n
+  \n
+if section_uid is None:\n
+  from Products.ERP5Type.Message import translateString\n
+  return context.Base_redirect(\'view\', keep_items=dict(\n
+    portal_status_message=translateString(\'Section must be defined.\')))\n
+\n
+\n
+return context.Delivery_viewDeliveryFastInputDialog(*args, **kw)\n
+</string> </value>
+        </item>
+        <item>
+            <key> <string>_code</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string>*args, **kw</string> </value>
+        </item>
+        <item>
+            <key> <string>errors</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_code</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>co_argcount</string> </key>
+                        <value> <int>0</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>args</string>
+                            <string>kw</string>
+                            <string>_getattr_</string>
+                            <string>context</string>
+                            <string>portal</string>
+                            <string>append</string>
+                            <string>$append0</string>
+                            <string>_getiter_</string>
+                            <string>x</string>
+                            <string>line_portal_type_list</string>
+                            <string>_getitem_</string>
+                            <string>line_portal_type</string>
+                            <string>use_list</string>
+                            <string>section_uid</string>
+                            <string>Products.ERP5Type.Message</string>
+                            <string>translateString</string>
+                            <string>dict</string>
+                            <string>len</string>
+                            <string>None</string>
+                            <string>_apply_</string>
+                          </tuple>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_defaults</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>Delivery_checkConsistencyForDeliveryFastInputDialog</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>

Modified: erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Delivery_getFastInputLineList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Delivery_getFastInputLineList.xml?rev=39971&r1=39970&r2=39971&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Delivery_getFastInputLineList.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Delivery_getFastInputLineList.xml [utf8] Fri Nov  5 17:15:20 2010
@@ -2,10 +2,7 @@
 <ZopeData>
   <record id="1" aka="AAAAAAAAAAE=">
     <pickle>
-      <tuple>
-        <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
-        <tuple/>
-      </tuple>
+      <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
     </pickle>
     <pickle>
       <dictionary>
@@ -75,33 +72,12 @@ if read_document_lines:\n
 else:\n
   line_list = []\n
 \n
-use_list = []\n
-# Check if the section and use preference are defined\n
 if line_portal_type in context.getPortalSaleTypeList():\n
   section_uid = context.getSourceSectionUid()\n
-  use_list = context.portal_preferences.getPreferredSaleUseList()\n
 elif line_portal_type in context.getPortalPurchaseTypeList():\n
   section_uid = context.getDestinationSectionUid()\n
-  use_list = context.portal_preferences.getPreferredPurchaseUseList()\n
 elif line_portal_type in context.getPortalInternalTypeList() + context.getPortalInventoryMovementTypeList():\n
-  section_uid = ""\n
-  use_list = context.portal_preferences.getPreferredPurchaseUseList() + \\\n
-             context.portal_preferences.getPreferredSaleUseList()\n
-else:\n
-  from Products.ERP5Type.Message import translateString\n
-  return context.Base_redirect(\'view\', keep_items=dict(\n
-    portal_status_message=translateString(\'Type of document not known to retrieve section.\')))\n
-\n
-if len(use_list) == 0:\n
-  from Products.ERP5Type.Message import translateString\n
-  return context.Base_redirect(\'view\', keep_items=dict(\n
-    portal_status_message=translateString(\'Use preference must be defined.\')))\n
-  \n
-if section_uid is None:\n
-  from Products.ERP5Type.Message import translateString\n
-  return context.Base_redirect(\'view\', keep_items=dict(\n
-    portal_status_message=translateString(\'Section must be defined.\')))\n
-\n
+  section_uid = None\n
 len_line_list = len(line_list)\n
 used_id = [] # list use to make sure we do not generate two line with same id/uid\n
 used_id_append = used_id.append\n
@@ -289,13 +265,9 @@ return result\n
                             <string>_getitem_</string>
                             <string>line_portal_type</string>
                             <string>line_list</string>
-                            <string>use_list</string>
                             <string>section_uid</string>
-                            <string>Products.ERP5Type.Message</string>
-                            <string>translateString</string>
-                            <string>dict</string>
-                            <string>len</string>
                             <string>None</string>
+                            <string>len</string>
                             <string>len_line_list</string>
                             <string>used_id</string>
                             <string>used_id_append</string>

Modified: erp5/trunk/bt5/erp5_trade/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_trade/bt/revision?rev=39971&r1=39970&r2=39971&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_trade/bt/revision [utf8] (original)
+++ erp5/trunk/bt5/erp5_trade/bt/revision [utf8] Fri Nov  5 17:15:20 2010
@@ -1 +1 @@
-999
\ No newline at end of file
+1002
\ No newline at end of file




More information about the Erp5-report mailing list