From 8f9e544b0800d6de9e147bc4ee8f579ce67c3cc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Mon, 4 Aug 2008 09:46:32 +0000 Subject: [PATCH] make sure we always show the currently selected account on AccountingTransactionLine_getNodeItemList. There might be a better way ... git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@22854 20353a03-c40f-0410-a6d1-a30d3c3de9de --- ...ountingTransactionLine_getNodeItemList.xml | 22 ++++++++++++++++++- bt5/erp5_accounting/bt/revision | 2 +- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionLine_getNodeItemList.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionLine_getNodeItemList.xml index a328aba36f..4551a8daff 100644 --- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionLine_getNodeItemList.xml +++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionLine_getNodeItemList.xml @@ -147,13 +147,26 @@ getItemList = CachingMethod(getItemList,\n \n # the cache vary with the simulation state of the current transaction,\n # to display all accounts when the transaction is already delivered.\n -return getItemList( category=category,\n +item_list = getItemList( category=category,\n portal_path=context.getPortalObject().getPhysicalPath(),\n mirror=mirror,\n omit_filter=omit_filter, # XXX possible optim: only one cache if omit_filter\n user_name=str(getSecurityManager().getUser()),\n simulation_state=context.getProperty(\n \'simulation_state\', \'no_simulation_state\') )\n +\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 +if omit_filter:\n + return item_list\n +\n +for node in (context.getSource(portal_type=\'Account\'),\n + context.getDestination(portal_type=\'Account\')):\n + if node:\n + if node not in [x[1] for x in item_list]:\n + return context.AccountingTransactionLine_getNodeItemList(mirror=mirror, omit_filter=1)\n +\n +return item_list\n </string> </value> </item> <item> @@ -220,6 +233,13 @@ return getItemList( category=category,\n <string>None</string> <string>getItemList</string> <string>str</string> + <string>item_list</string> + <string>_getiter_</string> + <string>node</string> + <string>append</string> + <string>$append0</string> + <string>x</string> + <string>_getitem_</string> </tuple> </value> </item> diff --git a/bt5/erp5_accounting/bt/revision b/bt5/erp5_accounting/bt/revision index b322bede21..826b140757 100644 --- a/bt5/erp5_accounting/bt/revision +++ b/bt5/erp5_accounting/bt/revision @@ -1 +1 @@ -729 \ No newline at end of file +730 \ No newline at end of file -- 2.30.9