Commit e7b7f51c authored by Fabien Morin's avatar Fabien Morin

revert r33615 : it's not good that getVariationCategoryList return categories

from the resource. We may want to use category defined manually on
transformation.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33761 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e06a435d
......@@ -185,20 +185,6 @@ class Transformation(XMLObject, Predicate, Variated):
self._setVariationBaseCategoryList(value)
self.reindexObject()
security.declareProtected(Permissions.AccessContentsInformation,
'getVariationCategoryList')
def getVariationCategoryList(self, **kwd):
"""
Returns the variation categories applicable to the Transformation.
When a resource is defined, it should not return more than what is
set through the Resource.
"""
resource = self.getResourceValue()
if resource is not None:
return resource.getVariationCategoryList(**kwd)
else:
return self.getVariationCategoryList(**kwd)
security.declareProtected(Permissions.AccessContentsInformation,
'getVariationCategoryItemList')
def getVariationCategoryItemList(self, base_category_list=(), base=1,
......
......@@ -146,6 +146,36 @@ class TestTransformation(TestTransformationMixin, ERP5TypeTestCase):
transformation.getVariationCategoryList()
)
def test_variationCategoryWithIndividualVariation(self):
'''Check that individual variation are return when getVariationCategoryList
is called on a transformation
'''
swimcap = self.createResource(
'Swimming Cap',
self.swimsuit_variation_base_category_list,
self.swimsuit_variation_category_list,
)
# create individual variation
individual_variation = swimcap.newContent(portal_type='Product Individual Variation')
transaction.commit()
self.tic()
transformation = self.createTransformation()
transformation.setResourceValue(swimcap)
transformation.edit(
title = 'Swimcap Production',
variation_base_category_list = \
self.swimsuit_variation_base_category_list + ['variation',]
)
# check the individual variation is returned by the
# getVariationCategoryList
individual_url = 'variation/%s' % individual_variation.getRelativeUrl()
self.assertTrue(individual_url in
transformation.getVariationCategoryList())
def test_transformedInventory(self):
portal = self.getPortal()
......
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