Commit a9bdd957 authored by Nicolas Delaby's avatar Nicolas Delaby

Avoid unnecessary KeyError when interrogating listbox lines, because keys...

Avoid unnecessary KeyError when interrogating listbox lines, because keys exists only if fields are editable (depending of TALES expression result here/isMovement on fields).

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@40843 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a6191635
...@@ -86,8 +86,14 @@ for line in listbox:\n ...@@ -86,8 +86,14 @@ for line in listbox:\n
\n \n
# update original line/cell if given\n # update original line/cell if given\n
if source_document is not None:\n if source_document is not None:\n
source_document.edit(quantity=line["quantity"],\n edit_kw = {}\n
price=line["price"])\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 else:\n
# if there was no document line already defined\n # if there was no document line already defined\n
# for the document, add a new document line\n # for the document, add a new document line\n
...@@ -187,16 +193,17 @@ return context.Base_redirect(kw[\'form_id\'], keep_items=dict(\n ...@@ -187,16 +193,17 @@ return context.Base_redirect(kw[\'form_id\'], keep_items=dict(\n
<string>line_id</string> <string>line_id</string>
<string>product</string> <string>product</string>
<string>source_document</string> <string>source_document</string>
<string>edit_kw</string>
<string>_write_</string>
<string>_apply_</string>
<string>key</string> <string>key</string>
<string>trade_document_line</string> <string>trade_document_line</string>
<string>_write_</string>
<string>variation_category_list</string> <string>variation_category_list</string>
<string>base_id</string> <string>base_id</string>
<string>list</string> <string>list</string>
<string>cell_key_list</string> <string>cell_key_list</string>
<string>cell_key</string> <string>cell_key</string>
<string>sorted_cell_key</string> <string>sorted_cell_key</string>
<string>_apply_</string>
<string>cell</string> <string>cell</string>
<string>dict</string> <string>dict</string>
</tuple> </tuple>
......
1051 1053
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment