[Erp5-report] r33615 nicolas.dumazet - in /erp5/trunk/products/ERP5: Document/ tests/
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Mar 11 08:44:12 CET 2010
Author: nicolas.dumazet
Date: Thu Mar 11 08:44:11 2010
New Revision: 33615
URL: http://svn.erp5.org?rev=33615&view=rev
Log:
Override getVariationCategoryList in Transformation Document, and test it
Modified:
erp5/trunk/products/ERP5/Document/Transformation.py
erp5/trunk/products/ERP5/tests/testTransformation.py
Modified: erp5/trunk/products/ERP5/Document/Transformation.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Transformation.py?rev=33615&r1=33614&r2=33615&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Transformation.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/Transformation.py [utf8] Thu Mar 11 08:44:11 2010
@@ -184,6 +184,20 @@
"""
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')
Modified: erp5/trunk/products/ERP5/tests/testTransformation.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testTransformation.py?rev=33615&r1=33614&r2=33615&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testTransformation.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testTransformation.py [utf8] Thu Mar 11 08:44:11 2010
@@ -126,6 +126,26 @@
# temp object
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):
portal = self.getPortal()
More information about the Erp5-report
mailing list