Commit 51c0bd49 authored by Nicolas Dumazet's avatar Nicolas Dumazet

Override getVariationCategoryList in Transformation Document, and test it


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33615 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9c53072e
...@@ -185,6 +185,20 @@ class Transformation(XMLObject, Predicate, Variated): ...@@ -185,6 +185,20 @@ class Transformation(XMLObject, Predicate, Variated):
self._setVariationBaseCategoryList(value) self._setVariationBaseCategoryList(value)
self.reindexObject() 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, security.declareProtected(Permissions.AccessContentsInformation,
'getVariationCategoryItemList') 'getVariationCategoryItemList')
def getVariationCategoryItemList(self, base_category_list=(), base=1, def getVariationCategoryItemList(self, base_category_list=(), base=1,
......
...@@ -126,6 +126,26 @@ class TestTransformation(TestTransformationMixin, ERP5TypeTestCase): ...@@ -126,6 +126,26 @@ class TestTransformation(TestTransformationMixin, ERP5TypeTestCase):
# temp object # temp object
self.assertTrue(aggregated_amount.isTested()) self.assertTrue(aggregated_amount.isTested())
def test_variationCategory(self):
swimcap = self.createResource(
'Swimming Cap',
self.swimsuit_variation_base_category_list,
self.swimsuit_variation_category_list,
)
transformation = self.createTransformation()
transformation.edit(
title = 'Swimcap Production',
variation_base_category_list = self.swimsuit_variation_base_category_list
)
transformation.setResourceValue(swimcap)
transaction.commit()
self.tic()
self.assertEquals(
swimcap.getVariationCategoryList(),
transformation.getVariationCategoryList()
)
def test_transformedInventory(self): def test_transformedInventory(self):
portal = self.getPortal() 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