Commit 3e4b077c authored by Jérome Perrin's avatar Jérome Perrin

sort the parralel listfield in same order than budget variations

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@37777 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 323270c2
...@@ -61,8 +61,9 @@ sub_field_dict = {}\n ...@@ -61,8 +61,9 @@ sub_field_dict = {}\n
split_depth = 1\n split_depth = 1\n
\n \n
# build a dict of title to display, based on the titles of corresponding\n # build a dict of title to display, based on the titles of corresponding\n
# budget variations\n # budget variations, and a dict of indexes for sorting\n
base_category_title_dict = dict()\n base_category_title_dict = dict()\n
base_category_int_index_dict = dict()\n
budget_line = container.REQUEST.get(\'here\')\n budget_line = container.REQUEST.get(\'here\')\n
if budget_line is not None:\n if budget_line is not None:\n
budget_model =budget_line.getParentValue().getSpecialiseValue()\n budget_model =budget_line.getParentValue().getSpecialiseValue()\n
...@@ -72,6 +73,9 @@ if budget_line is not None:\n ...@@ -72,6 +73,9 @@ if budget_line is not None:\n
base_category_title_dict[\n base_category_title_dict[\n
budget_variation.getProperty(\'variation_base_category\')\n budget_variation.getProperty(\'variation_base_category\')\n
] = budget_variation.getTitle()\n ] = budget_variation.getTitle()\n
base_category_int_index_dict[\n
budget_variation.getProperty(\'variation_base_category\')\n
] = budget_variation.getIntIndex()\n
\n \n
\n \n
resolveCategory = context.getPortalObject().portal_categories.resolveCategory\n resolveCategory = context.getPortalObject().portal_categories.resolveCategory\n
...@@ -101,6 +105,10 @@ for item in item_list:\n ...@@ -101,6 +105,10 @@ for item in item_list:\n
if item_value in value_list:\n if item_value in value_list:\n
sub_field_dict[item_key][\'value\'] =\\\n sub_field_dict[item_key][\'value\'] =\\\n
sub_field_dict[item_key][\'value\'] + [item_value]\n sub_field_dict[item_key][\'value\'] + [item_value]\n
\n
\n
sub_field_dict[item_key][\'int_index\'] = base_category_int_index_dict.get(\n
base_category, -1)\n
\n \n
if base_category in base_category_title_dict:\n if base_category in base_category_title_dict:\n
sub_field_dict[item_key][\'title\'] = base_category_title_dict[base_category]\n sub_field_dict[item_key][\'title\'] = base_category_title_dict[base_category]\n
...@@ -111,7 +119,9 @@ for item in item_list:\n ...@@ -111,7 +119,9 @@ for item in item_list:\n
else:\n else:\n
sub_field_dict[item_key][\'title\'] = base_category\n sub_field_dict[item_key][\'title\'] = base_category\n
\n \n
return sub_field_dict.values()\n sub_field_values = sub_field_dict.values()\n
sub_field_values.sort(key=lambda d:d[\'int_index\'])\n
return sub_field_values\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -157,6 +167,7 @@ return sub_field_dict.values()\n ...@@ -157,6 +167,7 @@ return sub_field_dict.values()\n
<string>split_depth</string> <string>split_depth</string>
<string>dict</string> <string>dict</string>
<string>base_category_title_dict</string> <string>base_category_title_dict</string>
<string>base_category_int_index_dict</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>container</string> <string>container</string>
<string>budget_line</string> <string>budget_line</string>
...@@ -177,6 +188,7 @@ return sub_field_dict.values()\n ...@@ -177,6 +188,7 @@ return sub_field_dict.values()\n
<string>base_category</string> <string>base_category</string>
<string>sub_field_property_dict</string> <string>sub_field_property_dict</string>
<string>base_category_value</string> <string>base_category_value</string>
<string>sub_field_values</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
327 328
\ 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