Commit 7ff5e9f5 authored by Jérome Perrin's avatar Jérome Perrin

accounting: include disabled entries showing the GAP roots in report dialogs

Instead of having empty string items which for which the meaning is not
really clear.
parent a51c7711
......@@ -7,32 +7,35 @@ categories from all available GAP.
portal = context.getPortalObject()
display_cache = {}
def display(x):
if x not in display_cache:
gap_id = x.getReference()
if gap_id:
display_cache[x] = '%s - %s' % (
gap_id,
x.getTranslatedShortTitle() or x.getTranslatedTitle())
else:
display_cache[x] = x.getIndentedTitle()
gap_id = x.getReference()
if gap_id:
return '%s - %s' % (
gap_id,
x.getTranslatedShortTitle() or x.getTranslatedTitle())
return x.getIndentedTitle()
return display_cache[x]
def getGapItemList(only_preferred_gap, gap_root=None):
if only_preferred_gap:
if gap_root:
return portal.portal_categories.resolveCategory(gap_root).getCategoryChildItemList(
base=False, is_self_excluded=True, display_method=display,
if only_preferred_gap and gap_root:
return portal.portal_categories.resolveCategory(gap_root).getCategoryChildItemList(
base=False,
is_self_excluded=True,
display_method=display,
display_none_category=False,
local_sort_id=('int_index', 'reference', 'id'))
result = []
for country in portal.portal_categories.gap.contentValues():
for gap_root in country.contentValues():
result.extend(gap_root.getCategoryChildItemList(
base=False, is_self_excluded=True, display_method=display,
local_sort_id=('int_index', 'reference', 'id')))
for gap_root_title, gap_root in context.AccountModule_getAvailableGapList():
if gap_root:
result.append((gap_root_title, None))
result.extend(
portal.portal_categories.resolveCategory(gap_root).getCategoryChildItemList(
base=False,
is_self_excluded=True,
display_method=display,
display_none_category=False,
local_sort_id=('int_index', 'reference', 'id')))
return result
from Products.ERP5Type.Cache import CachingMethod
......
......@@ -12,6 +12,8 @@ def getSubFieldDict():
for item in item_list:
# Get value of the item
item_value = item[int(not is_right_display)]
if item_value is None:
continue
# Hash key from item_value
item_split = item_value.split('/')
......
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