Commit a107c59c authored by Jérome Perrin's avatar Jérome Perrin

take into account the preferred gap in the cache

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@43309 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ceefd131
...@@ -57,6 +57,8 @@ categories from the GAP set in preferences, otherwise it will return\n ...@@ -57,6 +57,8 @@ categories from the GAP set in preferences, otherwise it will return\n
categories from all available GAP.\n categories from all available GAP.\n
"""\n """\n
\n \n
portal = context.getPortalObject()\n
\n
display_cache = {}\n display_cache = {}\n
def display(x):\n def display(x):\n
if x not in display_cache:\n if x not in display_cache:\n
...@@ -69,11 +71,9 @@ def display(x):\n ...@@ -69,11 +71,9 @@ def display(x):\n
\n \n
return display_cache[x]\n return display_cache[x]\n
\n \n
def getGapItemList(only_preferred_gap):\n def getGapItemList(only_preferred_gap, gap_root=None):\n
ctool = context.getPortalObject().portal_categories\n ctool = portal.portal_categories\n
if only_preferred_gap:\n if only_preferred_gap:\n
gap_root = context.getPortalObject().portal_preferences\\\n
.getPreferredAccountingTransactionGap()\n
if gap_root:\n if gap_root:\n
return ctool.resolveCategory(gap_root).getCategoryChildItemList(\n return ctool.resolveCategory(gap_root).getCategoryChildItemList(\n
base=False, is_self_excluded=True, display_method=display,\n base=False, is_self_excluded=True, display_method=display,\n
...@@ -89,7 +89,8 @@ def getGapItemList(only_preferred_gap):\n ...@@ -89,7 +89,8 @@ def getGapItemList(only_preferred_gap):\n
\n \n
from Products.ERP5Type.Cache import CachingMethod\n from Products.ERP5Type.Cache import CachingMethod\n
getGapItemList = CachingMethod(getGapItemList, id=\'Account_getGapItemList\', cache_factory=\'erp5_content_long\')\n getGapItemList = CachingMethod(getGapItemList, id=\'Account_getGapItemList\', cache_factory=\'erp5_content_long\')\n
return getGapItemList(only_preferred_gap=only_preferred_gap)\n return getGapItemList(only_preferred_gap=only_preferred_gap,\n
gap_root=portal.portal_preferences.getPreferredAccountingTransactionGap())\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
1437 1438
\ No newline at end of file \ No newline at end of file
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