Commit 88f5eb31 authored by Jérome Perrin's avatar Jérome Perrin

reuse Base_getPreferredSectionItemList

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32233 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 431a48df
......@@ -53,34 +53,13 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>section = context.portal_preferences.getPreferredSectionCategory() or\\\n
context.portal_preferences.getPreferredAccountingTransactionSectionCategory()\n
<value> <string>section_item_list = context.Base_getPreferredSectionItemList(portal_type=\'Organisation\')\n
current_destination_section = context.getDestinationSection()\n
if current_destination_section is not None and\\\n
current_destination_section not in zip(*section_item_list)[1]:\n
section_item_list.append((context.getDestinationSectionTitle(), context.getDestinationSection()))\n
\n
section_value = None\n
result = []\n
\n
if section is not None:\n
section_value = context.portal_categories.resolveCategory(section)\n
\n
if section_value is not None:\n
result = section_value.getGroupRelatedValueList(portal_type=\'Organisation\',\n
checked_permission=\'View\')\n
\n
result = [r for r in result\n
if r.getProperty(\'validation_state\') not in (\'invalidated\', \'deleted\')]\n
\n
\n
current_destination_section = context.getDestinationSectionValue()\n
\n
if current_destination_section is not None and current_destination_section not in result:\n
result.append(current_destination_section)\n
\n
def sorted(seq, key):\n
seq = seq[::]\n
seq.sort(key=key)\n
return seq\n
\n
return [(\'\', \'\')] + sorted([(i.getTitle(), i.getRelativeUrl()) for i in result], key=lambda x:x[0])\n
return section_item_list\n
</string> </value>
</item>
<item>
......@@ -119,17 +98,12 @@ return [(\'\', \'\')] + sorted([(i.getTitle(), i.getRelativeUrl()) for i in resu
<tuple>
<string>_getattr_</string>
<string>context</string>
<string>section</string>
<string>None</string>
<string>section_value</string>
<string>result</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
<string>r</string>
<string>section_item_list</string>
<string>current_destination_section</string>
<string>sorted</string>
<string>i</string>
<string>None</string>
<string>_getitem_</string>
<string>_apply_</string>
<string>zip</string>
</tuple>
</value>
</item>
......
......@@ -53,31 +53,13 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>section_cat = context.portal_preferences.getPreferredAccountingTransactionSectionCategory()\n
if section_cat in (None, \'\') : \n
section_cat = context.getPortalDefaultSectionCategory()\n
<value> <string>section_item_list = context.Base_getPreferredSectionItemList(portal_type=\'Organisation\')\n
current_source_section = context.getSourceSection()\n
if current_source_section is not None and\\\n
current_source_section not in zip(*section_item_list)[1]:\n
section_item_list.append((context.getSourceSectionTitle(), context.getSourceSection()))\n
\n
section_cat_obj = None\n
result = []\n
\n
if section_cat is not None:\n
# get the organisations belonging to this group\n
section_cat_obj = context.portal_categories.resolveCategory(section_cat)\n
\n
if section_cat_obj is not None:\n
result = section_cat_obj.getGroupRelatedValueList(portal_type=\'Organisation\',\n
checked_permission=\'Access contents information\')\n
result = [r for r in result\n
if r.getProperty(\'validation_state\') not in (\'invalidated\', \'deleted\')]\n
\n
current_source_section = context.getSourceSectionValue()\n
if current_source_section is not None and current_source_section not in result:\n
result.append(current_source_section)\n
\n
def sorted(seq, key):\n
seq = seq[::]\n
seq.sort(key=key)\n
return seq\n
return section_item_list\n
\n
# convert to ListField format\n
return [(\'\', \'\')] + sorted([(i.getTitle(), i.getRelativeUrl()) for i in result], key=lambda x:x[0])\n
......@@ -119,16 +101,17 @@ return [(\'\', \'\')] + sorted([(i.getTitle(), i.getRelativeUrl()) for i in resu
<tuple>
<string>_getattr_</string>
<string>context</string>
<string>section_cat</string>
<string>section_item_list</string>
<string>current_source_section</string>
<string>None</string>
<string>section_cat_obj</string>
<string>result</string>
<string>_getitem_</string>
<string>_apply_</string>
<string>zip</string>
<string>sorted</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
<string>r</string>
<string>current_source_section</string>
<string>sorted</string>
<string>result</string>
<string>i</string>
</tuple>
</value>
......
1096
\ No newline at end of file
1097
\ 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