Commit 91339447 authored by Julien Muchembled's avatar Julien Muchembled

Manage Field Library: add column to show the current template field

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30562 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1a495a0a
...@@ -140,15 +140,19 @@ for skin_folder_id in context.getTemplateSkinIdList():\n ...@@ -140,15 +140,19 @@ for skin_folder_id in context.getTemplateSkinIdList():\n
# XXX Should check if this field is used as a template\n # XXX Should check if this field is used as a template\n
field_path = \'%s/%s/%s\' % (skin_folder_id, form_id, field.getId())\n field_path = \'%s/%s/%s\' % (skin_folder_id, form_id, field.getId())\n
if field.meta_type == \'ProxyField\':\n if field.meta_type == \'ProxyField\':\n
template_form_id = field.get_value(\'form_id\')\n
template_id = \'%s/%s\' % (template_form_id,\n
field.get_value(\'field_id\'))\n
if field.getTemplateField() is None:\n if field.getTemplateField() is None:\n
modified_object_dict[field_path] = \'0_keep_dead_proxy_field\'\n modified_object_dict[field_path] = (\'0_keep_dead_proxy_field\',\n
template_id)\n
else:\n else:\n
template_form_id = field.get_value(\'form_id\')\n
if template_form_id not in (\n if template_form_id not in (\n
\'Base_viewFieldLibrary\',\n \'Base_viewFieldLibrary\',\n
field_library_id\n field_library_id\n
):\n ):\n
modified_object_dict[field_path] = \'2_unproxify_field\'\n modified_object_dict[field_path] = (\'2_unproxify_field\',\n
template_id)\n
else:\n else:\n
# Do not force proxification of field library field.\n # Do not force proxification of field library field.\n
# The nice developper probably have a good reason not to do it.\n # The nice developper probably have a good reason not to do it.\n
...@@ -158,22 +162,25 @@ for skin_folder_id in context.getTemplateSkinIdList():\n ...@@ -158,22 +162,25 @@ for skin_folder_id in context.getTemplateSkinIdList():\n
for field in form.objectValues():\n for field in form.objectValues():\n
field_path = \'%s/%s/%s\' % (skin_folder_id, form_id, field.getId())\n field_path = \'%s/%s/%s\' % (skin_folder_id, form_id, field.getId())\n
if field.meta_type == \'ProxyField\':\n if field.meta_type == \'ProxyField\':\n
template_form_id = field.get_value(\'form_id\')\n
template_id = \'%s/%s\' % (template_form_id,\n
field.get_value(\'field_id\'))\n
if field.getTemplateField() is None:\n if field.getTemplateField() is None:\n
modified_object_dict[field_path] = \'0_keep_dead_proxy_field\'\n modified_object_dict[field_path] = (\'0_keep_dead_proxy_field\',\n
template_id)\n
else:\n else:\n
template_form_id = field.get_value(\'form_id\')\n # XXX Only consider standard bt5 for now\n
# XXX Only considere standard bt5 for now\n
template_form_path = \'%s/%s\' % (skin_folder_id, template_form_id)\n template_form_path = \'%s/%s\' % (skin_folder_id, template_form_id)\n
if template_form_id != field_library_id:\n if template_form_id != field_library_id:\n
modified_object_dict[field_path] = \'2_unproxify_field\'\n modified_object_dict[field_path] = (\'2_unproxify_field\',\n
template_id)\n
# XXX Should proxify to a library\'s field\n # XXX Should proxify to a library\'s field\n
else:\n else:\n
# Check that there is no delegated values\n # Check that there is no delegated values\n
if field.delegated_list:\n if field.delegated_list:\n
# Found some delegated list\n # Found some delegated list\n
modified_object_dict[field_path] = \'0_check_delegated_value\'\n modified_object_dict[field_path] = (\n
else:\n \'0_check_delegated_value\', template_id)\n
pass\n
else:\n else:\n
# Do not force proxification of field.\n # Do not force proxification of field.\n
# The nice developper probably have a good reason not to do it.\n # The nice developper probably have a good reason not to do it.\n
...@@ -182,19 +189,23 @@ for skin_folder_id in context.getTemplateSkinIdList():\n ...@@ -182,19 +189,23 @@ for skin_folder_id in context.getTemplateSkinIdList():\n
i = 0\n i = 0\n
for key, value in modified_object_dict.items():\n for key, value in modified_object_dict.items():\n
line = newTempBase(context, \'tmp_install_%s\' %(str(i)))\n line = newTempBase(context, \'tmp_install_%s\' %(str(i)))\n
\n if isinstance(value, tuple):\n
value, template_id = value\n
else:\n
template_id = None\n
if value.startswith(\'0_\'):\n if value.startswith(\'0_\'):\n
choice = []\n choice = []\n
else:\n else:\n
choice = [value]\n choice = [value]\n
line.edit(\n line.edit(\n
object_id=key,\n object_id=key,\n
template_id=template_id,\n
choice=choice,\n choice=choice,\n
choice_item_list=[[action_title_dict[value], value]],\n choice_item_list=[[action_title_dict[value], value]],\n
)\n )\n
line.setUid(\'new_%s\' % key)\n line.setUid(\'new_%s\' % key)\n
field_list.append(line)\n field_list.append(line)\n
i += 1 \n i += 1\n
\n \n
field_list.sort(key=lambda x:(x.choice_item_list[0][1], x.object_id))\n field_list.sort(key=lambda x:(x.choice_item_list[0][1], x.object_id))\n
\n \n
...@@ -267,12 +278,15 @@ return field_list\n ...@@ -267,12 +278,15 @@ return field_list\n
<string>field</string> <string>field</string>
<string>field_path</string> <string>field_path</string>
<string>template_form_id</string> <string>template_form_id</string>
<string>template_id</string>
<string>template_form_path</string> <string>template_form_path</string>
<string>i</string> <string>i</string>
<string>key</string> <string>key</string>
<string>value</string> <string>value</string>
<string>str</string> <string>str</string>
<string>line</string> <string>line</string>
<string>isinstance</string>
<string>tuple</string>
<string>choice</string> <string>choice</string>
<string>_inplacevar_</string> <string>_inplacevar_</string>
</tuple> </tuple>
......
...@@ -352,6 +352,10 @@ ...@@ -352,6 +352,10 @@
<string>object_id</string> <string>object_id</string>
<string>ID</string> <string>ID</string>
</tuple> </tuple>
<tuple>
<string>template_id</string>
<string>Template</string>
</tuple>
<tuple> <tuple>
<string>choice</string> <string>choice</string>
<string>Update</string> <string>Update</string>
...@@ -420,9 +424,13 @@ ...@@ -420,9 +424,13 @@
<key> <string>hidden</string> </key> <key> <string>hidden</string> </key>
<value> <int>0</int> </value> <value> <int>0</int> </value>
</item> </item>
<item>
<key> <string>hide_rows_on_no_search_criterion</string> </key>
<value> <int>0</int> </value>
</item>
<item> <item>
<key> <string>lines</string> </key> <key> <string>lines</string> </key>
<value> <int>1000</int> </value> <value> <int>0</int> </value>
</item> </item>
<item> <item>
<key> <string>list_action</string> </key> <key> <string>list_action</string> </key>
......
526 527
\ 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