Commit 5717f6de authored by Jérome Perrin's avatar Jérome Perrin

change the way to check if an account can be proposed on an accounting...

change the way to check if an account can be proposed on an accounting transction line, getProperty is not supposed to do acquisition, so getProperty('simulation_state') on an accounting transaction line will always return the default. Call getSimulationState directly (which is actually acquired from parent transaction)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23506 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c19986f8
...@@ -130,7 +130,8 @@ def getItemList(category=None, portal_path=None, mirror=0, omit_filter=0,\n ...@@ -130,7 +130,8 @@ def getItemList(category=None, portal_path=None, mirror=0, omit_filter=0,\n
filter_dict = {}\n filter_dict = {}\n
\n \n
# we don\'t filter in existing transactions or report / search dialogs\n # we don\'t filter in existing transactions or report / search dialogs\n
if simulation_state not in (\'delivered\', \'cancelled\', \'no_simulation_state\'):\n if simulation_state not in (\'delivered\', \'stopped\',\n
\'cancelled\', \'no_simulation_state\'):\n
filter_dict[\'validation_state\'] = (\'draft\', \'validated\')\n filter_dict[\'validation_state\'] = (\'draft\', \'validated\')\n
\n \n
item_list = cat.getCategoryMemberItemList(\n item_list = cat.getCategoryMemberItemList(\n
...@@ -147,13 +148,15 @@ getItemList = CachingMethod(getItemList,\n ...@@ -147,13 +148,15 @@ getItemList = CachingMethod(getItemList,\n
\n \n
# the cache vary with the simulation state of the current transaction,\n # the cache vary with the simulation state of the current transaction,\n
# to display all accounts when the transaction is already delivered.\n # to display all accounts when the transaction is already delivered.\n
simulation_state = \'no_simulation_state\'\n
if hasattr(context, \'getSimulationState\'):\n
simulation_state = context.getSimulationState()\n
item_list = getItemList( category=category,\n item_list = getItemList( category=category,\n
portal_path=context.getPortalObject().getPhysicalPath(),\n portal_path=context.getPortalObject().getPhysicalPath(),\n
mirror=mirror,\n mirror=mirror,\n
omit_filter=omit_filter, # XXX possible optim: only one cache if omit_filter\n omit_filter=omit_filter, # XXX possible optim: only one cache if omit_filter\n
user_name=str(getSecurityManager().getUser()),\n user_name=str(getSecurityManager().getUser()),\n
simulation_state=context.getProperty(\n simulation_state=simulation_state)\n
\'simulation_state\', \'no_simulation_state\') )\n
\n \n
# make sure that the current value is included in this list, this is \n # make sure that the current value is included in this list, this is \n
# mostly for compatibility with old versions. XXX This is slow. \n # mostly for compatibility with old versions. XXX This is slow. \n
...@@ -235,9 +238,10 @@ return item_list\n ...@@ -235,9 +238,10 @@ return item_list\n
<string>sort</string> <string>sort</string>
<string>None</string> <string>None</string>
<string>getItemList</string> <string>getItemList</string>
<string>simulation_state</string>
<string>hasattr</string>
<string>str</string> <string>str</string>
<string>item_list</string> <string>item_list</string>
<string>hasattr</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>node</string> <string>node</string>
<string>append</string> <string>append</string>
......
764 765
\ 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