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

add validation_state parameter to Base_getPreferredSectionItemList

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@40239 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b73af9ca
...@@ -50,25 +50,19 @@ ...@@ -50,25 +50,19 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>section = context.portal_preferences.getPreferredSectionCategory() or\\\n <value> <string>portal = context.getPortalObject()\n
context.portal_preferences.getPreferredAccountingTransactionSectionCategory()\n section_category = portal.portal_preferences.getPreferredSectionCategory() or\\\n
portal.portal_preferences.getPreferredAccountingTransactionSectionCategory()\n
\n \n
if not section:\n if not section_category:\n
return [(\'\', \'\')]\n return [(\'\', \'\')]\n
\n \n
section_value = context.portal_categories.resolveCategory(section)\n group_uid = portal.portal_categories.getCategoryUid(section_category)\n
value_list = section_value.getGroupRelatedValueList(portal_type=portal_type,\n return [(\'\', \'\')] + [(x.getTitle(), x.getRelativeUrl()) for x in \n
checked_permission=\'View\')\n portal.portal_catalog(portal_type=portal_type,\n
value_list = [r for r in value_list\n validation_state=validation_state,\n
if r.getProperty(\'validation_state\') not in (\'invalidated\', \'deleted\')]\n default_group_uid=group_uid,\n
\n sort_on=(\'title\',))]\n
def sorted(seq, key):\n
seq = seq[::]\n
seq.sort(key=key)\n
return seq\n
\n
# convert to ListField format\n
return [(\'\', \'\')] + sorted([(obj.getTitle(), obj.getRelativeUrl()) for obj in value_list], key=lambda x: x[0])\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -79,7 +73,7 @@ return [(\'\', \'\')] + sorted([(obj.getTitle(), obj.getRelativeUrl()) for obj i ...@@ -79,7 +73,7 @@ return [(\'\', \'\')] + sorted([(obj.getTitle(), obj.getRelativeUrl()) for obj i
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>portal_type=[\'Organisation\']</string> </value> <value> <string>portal_type=[\'Organisation\'], validation_state=(\'validated\', \'draft\')</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -99,23 +93,23 @@ return [(\'\', \'\')] + sorted([(obj.getTitle(), obj.getRelativeUrl()) for obj i ...@@ -99,23 +93,23 @@ return [(\'\', \'\')] + sorted([(obj.getTitle(), obj.getRelativeUrl()) for obj i
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>1</int> </value> <value> <int>2</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
<value> <value>
<tuple> <tuple>
<string>portal_type</string> <string>portal_type</string>
<string>validation_state</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>section</string> <string>portal</string>
<string>section_value</string> <string>section_category</string>
<string>value_list</string> <string>group_uid</string>
<string>$list0</string> <string>append</string>
<string>$append0</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>r</string> <string>x</string>
<string>sorted</string>
<string>obj</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -131,6 +125,10 @@ return [(\'\', \'\')] + sorted([(obj.getTitle(), obj.getRelativeUrl()) for obj i ...@@ -131,6 +125,10 @@ return [(\'\', \'\')] + sorted([(obj.getTitle(), obj.getRelativeUrl()) for obj i
<list> <list>
<string>Organisation</string> <string>Organisation</string>
</list> </list>
<tuple>
<string>validated</string>
<string>draft</string>
</tuple>
</tuple> </tuple>
</value> </value>
</item> </item>
......
1785 1786
\ 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