Commit 64a70982 authored by Jérome Perrin's avatar Jérome Perrin Committed by Eteri

accounting: review AccountModule_getAvailableGapList

* Remove include_empty_item: We always want an empty item in dialogs
* Remove include_gap_in_path: This was always true

simplify code a little bit.
parent d95acf16
......@@ -3,18 +3,14 @@
# gap / country / gap_name
# so we always use as "root" the category of depth 2.
results = []
item_list = [('', '')]
countries = context.portal_categories.gap.objectValues()
for country in countries :
for gap in country.objectValues() :
title = gap.getParentValue().getTranslatedTitle() + '/'+ gap.getTranslatedTitle()
title = country.getTranslatedTitle() + '/'+ gap.getTranslatedTitle()
path = gap.getRelativeUrl()
if not include_gap_in_path :
path = path.replace('gap/', '')
item_list.append(
((country.getTranslatedTitle() + '/'+ gap.getTranslatedTitle()),
path))
results += [(title, path)]
if include_empty_item == 1:
results = [('', '')] + results
return results
return item_list
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>include_gap_in_path=1, include_empty_item=0</string> </value>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -284,7 +284,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python:here.AccountModule_getAvailableGapList(include_gap_in_path=1, include_empty_item=1)</string> </value>
<value> <string>python:here.AccountModule_getAvailableGapList()</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -299,7 +299,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python:here.AccountModule_getAvailableGapList(include_gap_in_path=1, include_empty_item=1)</string> </value>
<value> <string>python:here.AccountModule_getAvailableGapList()</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -275,7 +275,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python:here.AccountModule_getAvailableGapList(include_gap_in_path=1, include_empty_item=1)</string> </value>
<value> <string>python:here.AccountModule_getAvailableGapList()</string> </value>
</item>
</dictionary>
</pickle>
......
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