Commit 3bf45e81 authored by Jérome Perrin's avatar Jérome Perrin

Improve AccountModule_getBankAccountItemList to prevent displaying deleted bank accounts.

Update AccountingTransaction_getSourcePaymentItemList and AccountingTransaction_getDestinationPaymentItemList to use it.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15274 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9d44c79b
...@@ -68,25 +68,35 @@ ...@@ -68,25 +68,35 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>portal = context.getPortalObject()\n <value> <string>from ZTUtils import LazyFilter\n
if organisation == \'\' :\n portal = context.getPortalObject()\n
organisation = context.REQUEST.get(\'organisation\', None)\n \n
if organisation is None : \n if not organisation:\n
organisation = portal.portal_preferences\\\n organisation = portal.portal_preferences\\\n
.getPreferredAccountingTransactionSourceSection()\n .getPreferredAccountingTransactionSourceSection()\n
\n \n
organisation = portal.restrictedTraverse(organisation)\n if not organisation:\n
return [(\'\', \'\')]\n
\n
\n
organisation_value = portal.restrictedTraverse(organisation)\n
item_list = [(\'\', \'\')]\n item_list = [(\'\', \'\')]\n
for bank in organisation.contentValues(\n for bank in LazyFilter(organisation_value.contentValues(\n
portal_type=portal.getPortalPaymentNodeTypeList()):\n portal_type=portal.getPortalPaymentNodeTypeList()), skip=\'View\'):\n
if bank.getReference() and bank.getReference() != bank.getTitle():\n \n
item_list.append((\'%s - %s\' % (bank.getReference(),\n if skip_invalidated_bank_accounts and bank.getValidationState() == \'invalidated\':\n
bank.getTitle() or \n continue\n
bank.getSourceFreeText() or\n \n
bank.getSourceTitle()),\n if bank.getReference() and bank.getTitle() \\\n
bank.getRelativeUrl()))\n and bank.getReference() != bank.getTitle():\n
item_list.append((\'%s - %s\' % ( bank.getReference(),\n
bank.getTitle() or \n
bank.getSourceFreeText() or\n
bank.getSourceTitle()),\n
bank.getRelativeUrl()))\n
else:\n else:\n
item_list.append(( bank.getTitle() or \n item_list.append(( bank.getReference() or\n
bank.getTitle() or \n
bank.getSourceFreeText() or\n bank.getSourceFreeText() or\n
bank.getSourceTitle(),\n bank.getSourceTitle(),\n
bank.getRelativeUrl() ))\n bank.getRelativeUrl() ))\n
...@@ -106,9 +116,15 @@ return item_list\n ...@@ -106,9 +116,15 @@ return item_list\n
<none/> <none/>
</value> </value>
</item> </item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>organisation = \'\'</string> </value> <value> <string>organisation=None, skip_invalidated_bank_accounts=1</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -128,17 +144,20 @@ return item_list\n ...@@ -128,17 +144,20 @@ return item_list\n
<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>organisation</string> <string>organisation</string>
<string>skip_invalidated_bank_accounts</string>
<string>ZTUtils</string>
<string>LazyFilter</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>portal</string> <string>portal</string>
<string>None</string> <string>organisation_value</string>
<string>item_list</string> <string>item_list</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>bank</string> <string>bank</string>
...@@ -154,7 +173,8 @@ return item_list\n ...@@ -154,7 +173,8 @@ return item_list\n
<key> <string>func_defaults</string> </key> <key> <string>func_defaults</string> </key>
<value> <value>
<tuple> <tuple>
<string></string> <none/>
<int>1</int>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -68,26 +68,10 @@ ...@@ -68,26 +68,10 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>def sort(a, b):\n <value> <string>return context.AccountModule_getBankAccountItemList(\n
return cmp(a[0], b[0])\n organisation=context.getDestinationSection(),\n
\n skip_invalidated_bank_accounts=\n
item_list = [[\'\', \'\']]\n (context.getSimulationState() != \'delivered\'))\n
\n
entity = context.getDestinationSectionValue()\n
if entity is not None:\n
bank_account_id_list = entity.contentIds(filter={\'portal_type\':\n
entity.getPortalPaymentNodeTypeList()})\n
for bank_account_id in bank_account_id_list:\n
# skip objects we are not allowed to access\n
bank_account = entity.restrictedTraverse(bank_account_id, None)\n
if bank_account is not None and \\\n
bank_account.getValidationState() != \'invalidated\':\n
url = bank_account.getRelativeUrl()\n
label = bank_account.getReference() or bank_account.getTitle()\n
item_list.append([label, url])\n
\n
item_list.sort(sort)\n
return item_list\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -130,18 +114,8 @@ return item_list\n ...@@ -130,18 +114,8 @@ return item_list\n
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
<value> <value>
<tuple> <tuple>
<string>sort</string>
<string>item_list</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>entity</string>
<string>None</string>
<string>bank_account_id_list</string>
<string>_getiter_</string>
<string>bank_account_id</string>
<string>bank_account</string>
<string>url</string>
<string>label</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -68,26 +68,10 @@ ...@@ -68,26 +68,10 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>def sort(a, b):\n <value> <string>return context.AccountModule_getBankAccountItemList(\n
return cmp(a[0], b[0])\n organisation=context.getSourceSection(),\n
\n skip_invalidated_bank_accounts=\n
item_list = [[\'\', \'\']]\n (context.getSimulationState() != \'delivered\'))\n
\n
entity = context.getSourceSectionValue()\n
if entity is not None:\n
bank_account_id_list = entity.contentIds(filter={\'portal_type\':\n
entity.getPortalPaymentNodeTypeList()})\n
for bank_account_id in bank_account_id_list:\n
# skip objects we are not allowed to access\n
bank_account = entity.restrictedTraverse(bank_account_id, None)\n
if bank_account is not None and \\\n
bank_account.getValidationState() != \'invalidated\':\n
url = bank_account.getRelativeUrl()\n
label = bank_account.getReference() or bank_account.getTitle()\n
item_list.append([label, url])\n
\n
item_list.sort(sort)\n
return item_list\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -130,18 +114,8 @@ return item_list\n ...@@ -130,18 +114,8 @@ return item_list\n
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
<value> <value>
<tuple> <tuple>
<string>sort</string>
<string>item_list</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>entity</string>
<string>None</string>
<string>bank_account_id_list</string>
<string>_getiter_</string>
<string>bank_account_id</string>
<string>bank_account</string>
<string>url</string>
<string>label</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
365 368
\ 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