Commit 19272e33 authored by Jérome Perrin's avatar Jérome Perrin

accounting: simplify AccountingTransactionModule_getLedgerItemList

and rely on Base_getPreferredCategoryChildItemList to have results
sorted and displayed according to user preferences.
parent 675a0b03
......@@ -3,18 +3,12 @@
portal = context.getPortalObject()
portal_types = portal.portal_types
accounting_type_list = portal.getPortalAccountingTransactionTypeList()
ledger_set = set()
for accounting_type in accounting_type_list:
try:
new_ledger_list = portal_types[accounting_type].getLedgerValueList([])
ledger_set = ledger_set.union(set(new_ledger_list))
except AttributeError:
# This portal type doesn't inherit from Delivery Type, thus we can pass
continue
ledger_item_list = context.Base_getPreferredCategoryChildItemList(
portal.portal_categories.ledger, base=True)
if len(ledger_set):
return [[ledger.getTranslatedTitle(), ledger.getRelativeUrl()] for ledger in list(ledger_set)]
for accounting_type in portal.getPortalAccountingTransactionTypeList():
ledger_set.update(portal_types[accounting_type].getLedgerList(base=True))
return ()
return [item for item in ledger_item_list if item[1] in ledger_set]
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>source=True</string> </value>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
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