Commit eb636d8a authored by Jérome Perrin's avatar Jérome Perrin

Only build a hierarchical structure for line list when we are in...

Only build a hierarchical structure for line list when we are in report_tree_mode or domain_tree_mode.
Don't fail if selection is not initialized

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19060 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f1001b9b
...@@ -71,6 +71,12 @@ structure = {}\n ...@@ -71,6 +71,12 @@ structure = {}\n
structure[\'line\'] = None\n structure[\'line\'] = None\n
structure[\'line_list\'] = []\n structure[\'line_list\'] = []\n
\n \n
if not (is_report_tree_mode or is_domain_tree_mode):\n
# When this is not a report tree, return the "plain structure"\n
structure[\'line\'] = None\n
structure[\'line_list\'] = [dict(line=x, line_list=[]) for x in listbox_line_list]\n
return structure\n
\n
def order_line_list(line_list, current_structure, depth=0, index=0, last_dict=None):\n def order_line_list(line_list, current_structure, depth=0, index=0, last_dict=None):\n
if index < len(line_list):\n if index < len(line_list):\n
listbox_line = line_list[index]\n listbox_line = line_list[index]\n
...@@ -95,7 +101,6 @@ def order_line_list(line_list, current_structure, depth=0, index=0, last_dict=No ...@@ -95,7 +101,6 @@ def order_line_list(line_list, current_structure, depth=0, index=0, last_dict=No
index = order_line_list(line_list, current_structure, depth=depth, index=index, last_dict=last_dict)\n index = order_line_list(line_list, current_structure, depth=depth, index=index, last_dict=last_dict)\n
return index\n return index\n
\n \n
\n
order_line_list(listbox_line_list, structure, depth=-1, index=0)\n order_line_list(listbox_line_list, structure, depth=-1, index=0)\n
\n \n
return structure\n return structure\n
...@@ -117,7 +122,7 @@ return structure\n ...@@ -117,7 +122,7 @@ return structure\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>listbox_line_list=None</string> </value> <value> <string>listbox_line_list=None, is_report_tree_mode, is_domain_tree_mode</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -137,16 +142,23 @@ return structure\n ...@@ -137,16 +142,23 @@ return structure\n
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>1</int> </value> <value> <int>3</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
<value> <value>
<tuple> <tuple>
<string>listbox_line_list</string> <string>listbox_line_list</string>
<string>is_report_tree_mode</string>
<string>is_domain_tree_mode</string>
<string>structure</string> <string>structure</string>
<string>None</string> <string>None</string>
<string>_write_</string> <string>_write_</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
<string>x</string>
<string>dict</string>
<string>order_line_list</string> <string>order_line_list</string>
</tuple> </tuple>
</value> </value>
...@@ -161,6 +173,7 @@ return structure\n ...@@ -161,6 +173,7 @@ return structure\n
<value> <value>
<tuple> <tuple>
<none/> <none/>
<none/>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -63,10 +63,11 @@ ...@@ -63,10 +63,11 @@
editable_columns python: listbox.get_value(\'editable_columns\', REQUEST=request);\n editable_columns python: listbox.get_value(\'editable_columns\', REQUEST=request);\n
editable_fields python: dict([(column[0], getattr(listbox.aq_parent, \'listbox_%s\' % column[0], None)) for column in editable_columns]);\n editable_fields python: dict([(column[0], getattr(listbox.aq_parent, \'listbox_%s\' % column[0], None)) for column in editable_columns]);\n
selection python: here.portal_selections.getSelectionFor(selection_name, REQUEST=request);\n selection python: here.portal_selections.getSelectionFor(selection_name, REQUEST=request);\n
listbox_line_structure python: here.Listbox_getReportTreeStructure(listbox_line_list=listboxline_list);\n is_report_tree_mode selection/report_tree_mode | python: 0;\n
is_report_tree_mode selection/report_tree_mode | nothing;\n is_domain_tree_mode selection/domain_tree_mode | python: 0;\n
listbox_line_structure python: here.Listbox_getReportTreeStructure(listbox_line_list=listboxline_list, is_report_tree_mode=is_report_tree_mode, is_domain_tree_mode=is_domain_tree_mode);\n
max_section_depth python: max([x.getSectionDepth() for x in listboxline_list]) + int(is_report_tree_mode);\n max_section_depth python: max([x.getSectionDepth() for x in listboxline_list]) + int(is_report_tree_mode);\n
is_domain_tree_mode selection/domain_tree_mode | nothing;" i18n:domain="ui">\n " i18n:domain="ui">\n
\n \n
<tal:block metal:use-macro="here/listbox_line_ods_macro/macros/listbox_line"/>\n <tal:block metal:use-macro="here/listbox_line_ods_macro/macros/listbox_line"/>\n
\n \n
......
116 118
\ 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