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

Change CurrencyModule_getCurrencyItemList to accept "validation_state" parameter

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@40238 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e8f38a33
...@@ -56,18 +56,17 @@ from Products.CMFCore.permissions import AccessContentsInformation\n ...@@ -56,18 +56,17 @@ from Products.CMFCore.permissions import AccessContentsInformation\n
\n \n
portal = context.getPortalObject()\n portal = context.getPortalObject()\n
\n \n
def getCurrencyItemList(include_empty=1, portal_path=""):\n def getCurrencyItemList(include_empty=1, validation_state=validation_state):\n
result = []\n result = []\n
if include_empty :\n if include_empty :\n
result = [[\'\', \'\'],]\n result = [[\'\', \'\'],]\n
currency_module = portal.restrictedTraverse(\n currency_module = portal.restrictedTraverse(\n
\'currency_module\', \n \'currency_module\',\n
portal.restrictedTraverse(\'currency\', None))\n portal.restrictedTraverse(\'currency\', None))\n
\n \n
if currency_module is not None:\n if currency_module is not None:\n
for currency in LazyFilter(currency_module.contentValues(), skip=AccessContentsInformation):\n for currency in LazyFilter(currency_module.contentValues(), skip=AccessContentsInformation):\n
if not skip_invalidated or \\\n if currency.getProperty(\'validation_state\', \'validated\') in validation_state:\n
currency.getProperty(\'validation_state\', \'default\') != \'invalidated\':\n
# for currency, we intentionaly use reference (EUR) not title (Euros).\n # for currency, we intentionaly use reference (EUR) not title (Euros).\n
result.append((currency.getReference() or currency.getTitleOrId(),\n result.append((currency.getReference() or currency.getTitleOrId(),\n
currency.getRelativeUrl()))\n currency.getRelativeUrl()))\n
...@@ -81,8 +80,8 @@ getCurrencyItemList = CachingMethod(\n ...@@ -81,8 +80,8 @@ getCurrencyItemList = CachingMethod(\n
id=\'CurrencyModule_getCurrencyItemList\',\n id=\'CurrencyModule_getCurrencyItemList\',\n
cache_factory = \'erp5_ui_short\')\n cache_factory = \'erp5_ui_short\')\n
\n \n
return getCurrencyItemList( include_empty=include_empty,\n return getCurrencyItemList(include_empty=include_empty,\n
portal_path=portal.getPath() )\n validation_state=validation_state)\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -93,7 +92,7 @@ return getCurrencyItemList( include_empty=include_empty,\n ...@@ -93,7 +92,7 @@ return getCurrencyItemList( include_empty=include_empty,\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>include_empty=1, skip_invalidated=1</string> </value> <value> <string>include_empty=1, validation_state=(\'validated\', \'draft\')</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -120,7 +119,7 @@ return getCurrencyItemList( include_empty=include_empty,\n ...@@ -120,7 +119,7 @@ return getCurrencyItemList( include_empty=include_empty,\n
<value> <value>
<tuple> <tuple>
<string>include_empty</string> <string>include_empty</string>
<string>skip_invalidated</string> <string>validation_state</string>
<string>ZTUtils</string> <string>ZTUtils</string>
<string>LazyFilter</string> <string>LazyFilter</string>
<string>Products.CMFCore.permissions</string> <string>Products.CMFCore.permissions</string>
...@@ -144,7 +143,10 @@ return getCurrencyItemList( include_empty=include_empty,\n ...@@ -144,7 +143,10 @@ return getCurrencyItemList( include_empty=include_empty,\n
<value> <value>
<tuple> <tuple>
<int>1</int> <int>1</int>
<int>1</int> <tuple>
<string>validated</string>
<string>draft</string>
</tuple>
</tuple> </tuple>
</value> </value>
</item> </item>
......
895 896
\ 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