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 @@ ...@@ -3,18 +3,12 @@
portal = context.getPortalObject() portal = context.getPortalObject()
portal_types = portal.portal_types portal_types = portal.portal_types
accounting_type_list = portal.getPortalAccountingTransactionTypeList()
ledger_set = set() ledger_set = set()
for accounting_type in accounting_type_list: ledger_item_list = context.Base_getPreferredCategoryChildItemList(
try: portal.portal_categories.ledger, base=True)
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
if len(ledger_set): for accounting_type in portal.getPortalAccountingTransactionTypeList():
return [[ledger.getTranslatedTitle(), ledger.getRelativeUrl()] for ledger in list(ledger_set)] 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 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>source=True</string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <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