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
\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_id\'], keep_items=dict(\n
<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>
......
1051
\ No newline at end of file
1053
\ 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