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

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Nov 29 10:35:17 CET 2010


Author: nicolas
Date: Mon Nov 29 10:35:16 2010
New Revision: 40843

URL: http://svn.erp5.org?rev=40843&view=rev
Log:
Avoid unnecessary KeyError when interrogating listbox lines, because keys exists only if fields are editable (depending of TALES expression result here/isMovement on fields).

Modified:
    erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Delivery_setFastInputLineList.xml
    erp5/trunk/bt5/erp5_trade/bt/revision

Modified: erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Delivery_setFastInputLineList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Delivery_setFastInputLineList.xml?rev=40843&r1=40842&r2=40843&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Delivery_setFastInputLineList.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Delivery_setFastInputLineList.xml [utf8] Mon Nov 29 10:35:16 2010
@@ -86,8 +86,14 @@ for line in listbox:\n
 \n
     # update original line/cell if given\n
     if source_document is not None:\n
-      source_document.edit(quantity=line["quantity"],\n
-                           price=line["price"])\n
+      edit_kw = {}\n
+      if \'quantity\' in line:\n
+        # if quantity is editable field\n
+        edit_kw[\'quantity\'] = line[\'quantity\']\n
+      if \'price\' in line:\n
+        # if price is editable field\n
+        edit_kw[\'price\'] = line[\'price\']\n
+      source_document.edit(**edit_kw)\n
     else:\n
       # if there was no document line already defined\n
       # for the document, add a new document line\n
@@ -187,16 +193,17 @@ return context.Base_redirect(kw[\'form_i
                             <string>line_id</string>
                             <string>product</string>
                             <string>source_document</string>
+                            <string>edit_kw</string>
+                            <string>_write_</string>
+                            <string>_apply_</string>
                             <string>key</string>
                             <string>trade_document_line</string>
-                            <string>_write_</string>
                             <string>variation_category_list</string>
                             <string>base_id</string>
                             <string>list</string>
                             <string>cell_key_list</string>
                             <string>cell_key</string>
                             <string>sorted_cell_key</string>
-                            <string>_apply_</string>
                             <string>cell</string>
                             <string>dict</string>
                           </tuple>

Modified: erp5/trunk/bt5/erp5_trade/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_trade/bt/revision?rev=40843&r1=40842&r2=40843&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_trade/bt/revision [utf8] (original)
+++ erp5/trunk/bt5/erp5_trade/bt/revision [utf8] Mon Nov 29 10:35:16 2010
@@ -1 +1 @@
-1051
\ No newline at end of file
+1053
\ No newline at end of file




More information about the Erp5-report mailing list