Commit 0f3c4c54 authored by Sebastien Robin's avatar Sebastien Robin

- 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
parent 46fa97b8
...@@ -74,8 +74,7 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase): ...@@ -74,8 +74,7 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase):
def getBusinessTemplateList(self): def getBusinessTemplateList(self):
"""Business Templates required for this test. """Business Templates required for this test.
""" """
return ('erp5_base', 'erp5_pdm', 'erp5_trade', 'erp5_apparel', return ('erp5_base', 'erp5_pdm', 'erp5_trade', 'erp5_apparel')
'erp5_accounting', 'erp5_invoicing')
def afterSetUp(self, quiet=1, run=run_all_test): def afterSetUp(self, quiet=1, run=run_all_test):
self.login() self.login()
...@@ -157,8 +156,10 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase): ...@@ -157,8 +156,10 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase):
aggregate_value_list = [item_list[0], item_list[2]] aggregate_value_list = [item_list[0], item_list[2]]
inventory_line = inventory.newContent(portal_type = self.inventory_line_portal_type) inventory_line = inventory.newContent(portal_type = self.inventory_line_portal_type)
inventory_line.edit(resource_value = resource, inventory_line.edit(resource_value = resource,
inventory = 12., # Arbitrary inventory ; it should be never accessed while aggregating items
aggregate_value_list = aggregate_value_list) 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.deliver()
inventory_list.append(inventory) inventory_list.append(inventory)
sequence.edit(inventory_list = inventory_list) sequence.edit(inventory_list = inventory_list)
...@@ -1796,8 +1797,10 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase): ...@@ -1796,8 +1797,10 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase):
inventory = sequence.get('inventory_list')[0] inventory = sequence.get('inventory_list')[0]
inventory_line = inventory['1'] inventory_line = inventory['1']
item_list = sequence.get('item_list') item_list = sequence.get('item_list')
aggregate_value_list = [item_list[0],item_list[1], item_list[4]]
inventory_line.edit( 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): def test_01_getInventory(self, quiet=0, run=run_all_test):
......
...@@ -77,8 +77,9 @@ class TestOrderMixin: ...@@ -77,8 +77,9 @@ class TestOrderMixin:
self.validateRules() self.validateRules()
def createCurrency(self): def createCurrency(self):
portal = self.getPortal() currency_module = self.getPortal().currency_module
portal.currency_module.newContent(id='euro', reference='EUR', title='EURO') if currency_module._getOb('euro', None) is None:
currency_module.newContent(id='euro', reference='EUR', title='EURO')
def createCategories(self): def createCategories(self):
""" """
......
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