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