Commit 4388020b authored by Romain Courteaud's avatar Romain Courteaud

Add method getVariationBaseCategoryItemList.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@2778 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1a9e2cab
...@@ -155,6 +155,24 @@ class Variated(Base): ...@@ -155,6 +155,24 @@ class Variated(Base):
""" """
return self.portal_categories.getItemList(self.getVariationRangeBaseCategoryList()) return self.portal_categories.getItemList(self.getVariationRangeBaseCategoryList())
security.declareProtected(Permissions.AccessContentsInformation,
'getVariationBaseCategoryItemList')
def getVariationBaseCategoryItemList(self, display_id='title_or_id'):
"""
Returns base category of the resource
as a list of tuples (title, id). This is mostly
useful in ERP5Form instances to generate selection
menus.
"""
variation_base_category_list = self.getVariationBaseCategoryList()
result = []
for base_category in variation_base_category_list:
bc = self.portal_categories.resolveCategory(base_category)
result.extend(Renderer(display_base_category=0,
display_none_category=0, base=1,
display_id=display_id).render([bc]))
return result
# Methods for matrix UI widgets # Methods for matrix UI widgets
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getLineVariationRangeCategoryItemList') 'getLineVariationRangeCategoryItemList')
......
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