From 0f3c4c54dfe4bb371e6da0df392fbc38b5dc2942 Mon Sep 17 00:00:00 2001 From: Sebastien Robin <seb@nexedi.com> Date: Fri, 19 Jun 2009 15:00:56 +0000 Subject: [PATCH] - erp5_accounting and erp5_invoicing bt are useless for testInventory - set manually the quantity on lines, it is not calculated automatically any more by default with the list of items. - make sure to not create again the currency when it is already there - do not set the inventory property on inventory line, this is useless and deprecated git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27689 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/tests/testInventory.py | 11 +++++++---- product/ERP5/tests/testOrder.py | 5 +++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/product/ERP5/tests/testInventory.py b/product/ERP5/tests/testInventory.py index 32ff8b9905..191d986227 100644 --- a/product/ERP5/tests/testInventory.py +++ b/product/ERP5/tests/testInventory.py @@ -74,8 +74,7 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase): def getBusinessTemplateList(self): """Business Templates required for this test. """ - return ('erp5_base', 'erp5_pdm', 'erp5_trade', 'erp5_apparel', - 'erp5_accounting', 'erp5_invoicing') + return ('erp5_base', 'erp5_pdm', 'erp5_trade', 'erp5_apparel') def afterSetUp(self, quiet=1, run=run_all_test): self.login() @@ -157,8 +156,10 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase): aggregate_value_list = [item_list[0], item_list[2]] inventory_line = inventory.newContent(portal_type = self.inventory_line_portal_type) inventory_line.edit(resource_value = resource, - inventory = 12., # Arbitrary inventory ; it should be never accessed while aggregating items aggregate_value_list = aggregate_value_list) + # Now, quantity is not defined any more automatically. + inventory_line.edit(quantity=sum([x.getQuantity() for x in \ + aggregate_value_list])) inventory.deliver() inventory_list.append(inventory) sequence.edit(inventory_list = inventory_list) @@ -1796,8 +1797,10 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase): inventory = sequence.get('inventory_list')[0] inventory_line = inventory['1'] item_list = sequence.get('item_list') + aggregate_value_list = [item_list[0],item_list[1], item_list[4]] inventory_line.edit( - aggregate_value_list = [item_list[0],item_list[1], item_list[4]]) + aggregate_value_list=aggregate_value_list, + quantity=sum([x.getQuantity() for x in aggregate_value_list])) def test_01_getInventory(self, quiet=0, run=run_all_test): diff --git a/product/ERP5/tests/testOrder.py b/product/ERP5/tests/testOrder.py index 0ecd9f5267..b00df44875 100644 --- a/product/ERP5/tests/testOrder.py +++ b/product/ERP5/tests/testOrder.py @@ -77,8 +77,9 @@ class TestOrderMixin: self.validateRules() def createCurrency(self): - portal = self.getPortal() - portal.currency_module.newContent(id='euro', reference='EUR', title='EURO') + currency_module = self.getPortal().currency_module + if currency_module._getOb('euro', None) is None: + currency_module.newContent(id='euro', reference='EUR', title='EURO') def createCategories(self): """ -- 2.30.9