diff --git a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SupplyCell_asPredicate.xml b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SupplyCell_asPredicate.xml index 06de56c40a42f708d895bba80aeeec436548774e..6e9d2fdd4dca1d4085978e1003b0a812ff00bfdf 100644 --- a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SupplyCell_asPredicate.xml +++ b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SupplyCell_asPredicate.xml @@ -67,6 +67,9 @@ if context.getDestination():\n base_category_tuple += (\'destination\',)\n \n if context.hasProductLine():\n + category_list = context.getCategoryList() + [\n + pl.getRelativeUrl() for pl in context.getProductLineValue().getCategoryChildValueList()]\n + context = context.asContext(categories=category_list)\n base_category_tuple += (\'product_line\', )\n \n if context.getParentValue().getParentValue().getPortalType() in (\n diff --git a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SupplyLine_asPredicate.xml b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SupplyLine_asPredicate.xml index b8e68144379dd6dc4daae43744703e578e4478a6..7cf19f88f920577acf173222fc6e6479f4a97608 100644 --- a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SupplyLine_asPredicate.xml +++ b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/SupplyLine_asPredicate.xml @@ -69,6 +69,9 @@ if context.getDestination():\n base_category_tuple += (\'destination\',)\n \n if context.hasProductLine():\n + category_list = context.getCategoryList() + [\n + pl.getRelativeUrl() for pl in context.getProductLineValue().getCategoryChildValueList()]\n + context = context.asContext(categories=category_list)\n base_category_tuple += (\'product_line\', )\n \n if context.getParentValue().getPortalType() in (\n diff --git a/product/ERP5/tests/testResource.py b/product/ERP5/tests/testResource.py index 644611b1fdbb8d5f92d5fb80f7e1b0cf981b79ea..19adf1b9fe66510a931e2bfa667f64868d9945c5 100644 --- a/product/ERP5/tests/testResource.py +++ b/product/ERP5/tests/testResource.py @@ -192,6 +192,9 @@ class TestResource(ERP5TypeTestCase): product_line.newContent( id='a', portal_type='Category') + product_line.a.newContent( + id='a1', + portal_type='Category') if product_line._getOb('b', None) is None: product_line.newContent( id='b', @@ -1092,6 +1095,9 @@ class TestResource(ERP5TypeTestCase): resource_a = self.portal.getDefaultModule(self.product_portal_type)\ .newContent(portal_type=self.product_portal_type) resource_a.setProductLineValue(self.portal.portal_categories.product_line.a) + resource_a_1 = self.portal.getDefaultModule(self.product_portal_type)\ + .newContent(portal_type=self.product_portal_type) + resource_a_1.setProductLineValue(self.portal.portal_categories.product_line.a.a1) resource_b = self.portal.getDefaultModule(self.product_portal_type)\ .newContent(portal_type=self.product_portal_type) resource_b.setProductLineValue(self.portal.portal_categories.product_line.b) @@ -1105,6 +1111,14 @@ class TestResource(ERP5TypeTestCase): # resource_a is member of product_line/a, so our supply line applies. self.assertEqual(1000, sale_order_line.getPrice()) + sale_order_line = self.portal.getDefaultModule("Sale Order").newContent( + portal_type='Sale Order').newContent( + portal_type=self.sale_order_line_portal_type, + resource_value=resource_a_1, + quantity=1) + # resource_a_1 is member of product_line/a/a1, so our supply line applies. + self.assertEqual(1000, sale_order_line.getPrice()) + sale_order_line = self.portal.getDefaultModule("Sale Order").newContent( portal_type='Sale Order').newContent( portal_type=self.sale_order_line_portal_type,