Commit 6ce41dba authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki Committed by Jérome Perrin

erp5_accounting, erp5_payment_mean: display currently selected Bank Account...

erp5_accounting, erp5_payment_mean: display currently selected Bank Account even if it is invalidated.
parent 87beef4e
......@@ -10,6 +10,9 @@ organisation, using the following policy:
If organisation is not passed, this script will return all bank accounts
applicable for section_category and section_category_strict_membership.
If `base_category` is passed, the currently linked bank account with the specified
base_category is anyway included.
"""
portal = context.getPortalObject()
......@@ -56,11 +59,19 @@ item_list = [('', '')]
include_organisation_hierarchy = len(set(
['/'.join(b.path.split('/')[:-1]) for b in bank_account_list])) > 1
bank_account_list = [brain.getObject() for brain in sorted(
bank_account_list, key=lambda b:b.path
)]
if base_category is not None:
current_value = context.getProperty(base_category + '_value')
if current_value not in bank_account_list:
bank_account_list.append(current_value)
previous_organisation = None
# sort bank accounts in a way that bank accounts from the same
# organisation are consecutive
for brain in sorted(bank_account_list, key=lambda b:b.path):
bank = brain.getObject()
for bank in bank_account_list:
if include_organisation_hierarchy:
organisation = bank.getParentValue()
if organisation != previous_organisation:
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>organisation=None, skip_invalidated_bank_accounts=0, section_category=None, section_category_strict_membership=False</string> </value>
<value> <string>organisation=None, skip_invalidated_bank_accounts=0, section_category=None, section_category_strict_membership=False, base_category=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
return context.AccountModule_getBankAccountItemList(
organisation=context.getDestinationSection(),
base_category='destination_payment',
skip_invalidated_bank_accounts=
(context.getSimulationState() != 'delivered'))
return context.AccountModule_getBankAccountItemList(
organisation=context.getSourceSection(),
base_category='source_payment',
skip_invalidated_bank_accounts=
(context.getSimulationState() != 'delivered'))
return context.AccountModule_getBankAccountItemList(
organisation=context.getSourceSection(),
base_category='source_payment',
skip_invalidated_bank_accounts=
(context.getValidationState() != 'delivered'))
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