From 9326803a2600841641ec633bfcd069f165b3890d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Nowak?= <luke@nexedi.com> Date: Thu, 3 Jul 2008 13:41:32 +0000 Subject: [PATCH] - set up system preference, to have individual variations, introduce creation of resource individually variated git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@22254 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/tests/testProductionOrder.py | 61 +++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/product/ERP5/tests/testProductionOrder.py b/product/ERP5/tests/testProductionOrder.py index 905cde92a0..726b4e13a6 100644 --- a/product/ERP5/tests/testProductionOrder.py +++ b/product/ERP5/tests/testProductionOrder.py @@ -59,6 +59,28 @@ class TestProductionOrderMixin(TestOrderMixin): def login(self, quiet=0, run=1): ERP5TypeTestCase.login(self) + def setUpPreferences(self): + portal = self.getPortal() + preferences = getToolByName(portal,'portal_preferences') + + system_preference = preferences.newContent( + portal_type = 'System Preference' + ) + + system_preference.edit( + preferred_product_individual_variation_base_category = ('variation',), + preferred_component_individual_variation_base_category = ('variation',), + priority = 1, + ) + + system_preference.enable() + get_transaction().commit() + self.tic() + + def afterSetUp(self): + TestOrderMixin.afterSetUp(self) + self.setUpPreferences() + def createCategories(self): """ Light install create only base categories, so we create @@ -72,6 +94,45 @@ class TestProductionOrderMixin(TestOrderMixin): portal_type='Category', id=category_id) + def stepCreateVariatedResource(self, sequence=None, sequence_list=None, \ + **kw): + """ + Create a resource with variation + """ + portal = self.getPortal() + resource_module = portal.getDefaultModule(self.resource_portal_type) + resource = resource_module.newContent(portal_type=self.resource_portal_type) + resource.edit( + title = "VariatedResource", + industrial_phase_list=["phase1", "phase2"], + product_line = 'apparel' + ) + +# resource.setSizeList(self.size_list) + # Add colour variation + colour_variation_count = 3 + for i in range(colour_variation_count): + variation_portal_type = 'Product Individual Variation' + variation = resource.newContent(portal_type = variation_portal_type) + variation.edit( + title = 'ColourVariation%s' % str(i), + variation_base_category_list = ('variation',) + ) + # Add morphology variation + morphology_variation_count = 2 + for i in range(morphology_variation_count) : + variation_portal_type = 'Product Individual Variation' + variation = resource.newContent(portal_type=variation_portal_type) + variation.edit( + title = 'MorphologyVariation%s' % str(i), + variation_base_category_list = ('variation',) + ) + + sequence.edit( resource = resource ) + resource_list = sequence.get('resource_list',default=[]) + resource_list.append(resource) + sequence.edit( resource_list = resource_list ) + def stepClearActivities(self, sequence=None, sequence_list=None, **kw): """ -- 2.30.9