Commit f8299ce6 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

cleanup code.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30334 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 26d7f69d
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
# Sebastien Robin <seb@nexedi.com> # Sebastien Robin <seb@nexedi.com>
# #
# WARNING: This program as such is intended to be used by professional # WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential # programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs # consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial # End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software # guarantees and support are strongly adviced to contract a Free Software
# Service Company # Service Company
# #
# This program is Free Software; you can redistribute it and/or # This program is Free Software; you can redistribute it and/or
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from DateTime import DateTime from DateTime import DateTime
from zLOG import LOG
from Products.ERP5Type.tests.Sequence import SequenceList from Products.ERP5Type.tests.Sequence import SequenceList
from testOrder import TestOrderMixin from testOrder import TestOrderMixin
...@@ -95,7 +94,7 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase): ...@@ -95,7 +94,7 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase):
resource_value=sequence.get('resource'), resource_value=sequence.get('resource'),
quantity=month*10) quantity=month*10)
deliverPackingList(spl) deliverPackingList(spl)
ipl = iplm.newContent( ipl = iplm.newContent(
portal_type='Internal Packing List', portal_type='Internal Packing List',
source_value = sequence.get('organisation1'), source_value = sequence.get('organisation1'),
...@@ -106,13 +105,12 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase): ...@@ -106,13 +105,12 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase):
resource_value=sequence.get('resource'), resource_value=sequence.get('resource'),
quantity=month*10) quantity=month*10)
deliverPackingList(ipl) deliverPackingList(ipl)
def createInventory(self, start_date=None, def createInventory(self, start_date=None,
sequence=None,**kw): sequence=None,**kw):
""" """
We will put default values for an inventory We will put default values for an inventory
""" """
portal = self.getPortal()
organisation = sequence.get('organisation1') organisation = sequence.get('organisation1')
inventory = self.getInventoryModule().newContent() inventory = self.getInventoryModule().newContent()
inventory.edit(start_date=start_date, inventory.edit(start_date=start_date,
...@@ -128,7 +126,6 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase): ...@@ -128,7 +126,6 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase):
""" """
We will put default values for an inventory We will put default values for an inventory
""" """
portal = self.getPortal()
inventory = sequence.get('inventory_list')[-1] inventory = sequence.get('inventory_list')[-1]
resource = sequence.get('resource_list')[-1] resource = sequence.get('resource_list')[-1]
inventory_line = inventory.newContent( inventory_line = inventory.newContent(
...@@ -142,9 +139,7 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase): ...@@ -142,9 +139,7 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase):
""" """
We will put default values for an inventory We will put default values for an inventory
""" """
portal = self.getPortal()
date = DateTime(self.first_date_string) date = DateTime(self.first_date_string)
LOG('stepCreateFirstNotVariatedInventory, date',0,date)
quantity=self.default_quantity quantity=self.default_quantity
self.createInventory(start_date=date,sequence=sequence) self.createInventory(start_date=date,sequence=sequence)
self.createNotVariatedInventoryLine(sequence=sequence, self.createNotVariatedInventoryLine(sequence=sequence,
...@@ -155,7 +150,6 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase): ...@@ -155,7 +150,6 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase):
""" """
We will put default values for an inventory We will put default values for an inventory
""" """
portal = self.getPortal()
date = DateTime(self.second_date_string) date = DateTime(self.second_date_string)
quantity=self.default_quantity - 2 quantity=self.default_quantity - 2
self.createInventory(start_date=date,sequence=sequence) self.createInventory(start_date=date,sequence=sequence)
...@@ -171,7 +165,7 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase): ...@@ -171,7 +165,7 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase):
quantity=self.default_quantity quantity=self.default_quantity
inventory_line = self.second_inventory.objectValues()[0] inventory_line = self.second_inventory.objectValues()[0]
inventory_line.edit(inventory=quantity) inventory_line.edit(inventory=quantity)
def stepCheckFirstNotVariatedInventory(self, start_date=None,quantity=None, def stepCheckFirstNotVariatedInventory(self, start_date=None,quantity=None,
sequence=None,**kw): sequence=None,**kw):
...@@ -188,10 +182,6 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase): ...@@ -188,10 +182,6 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase):
node_uid = sequence.get('organisation1').getUid() node_uid = sequence.get('organisation1').getUid()
resource_url = sequence.get('resource').getRelativeUrl() resource_url = sequence.get('resource').getRelativeUrl()
date = DateTime(self.view_stock_date) date = DateTime(self.view_stock_date)
LOG('CheckSecondNotVariatedInventory', 0,
self.getSimulationTool().getInventory(node_uid=node_uid,
resource=resource_url,
to_date=date,src__=1))
quantity = self.getSimulationTool().getInventory(node_uid=node_uid, quantity = self.getSimulationTool().getInventory(node_uid=node_uid,
resource=resource_url, resource=resource_url,
to_date=date,simulation_state='delivered') to_date=date,simulation_state='delivered')
...@@ -238,13 +228,12 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase): ...@@ -238,13 +228,12 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase):
sequence_list.play(self) sequence_list.play(self)
def createVariatedInventoryLine(self, sequence=None, sequence_list=None, def createVariatedInventoryLine(self, sequence=None, sequence_list=None,
start_date=None, quantity=None, item_list=None, start_date=None, quantity=None, item_list=None,
**kw): **kw):
""" """
We will put default values for an inventory We will put default values for an inventory
""" """
portal = self.getPortal()
inventory = sequence.get('inventory_list')[-1] inventory = sequence.get('inventory_list')[-1]
resource = sequence.get('resource_list')[-1] resource = sequence.get('resource_list')[-1]
inventory_line = inventory.newContent( inventory_line = inventory.newContent(
...@@ -277,7 +266,6 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase): ...@@ -277,7 +266,6 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase):
""" """
We will put default values for an inventory We will put default values for an inventory
""" """
portal = self.getPortal()
date = DateTime(self.first_date_string) date = DateTime(self.first_date_string)
inventory = self.createInventory(start_date=date,sequence=sequence) inventory = self.createInventory(start_date=date,sequence=sequence)
quantity = self.default_quantity quantity = self.default_quantity
...@@ -289,7 +277,6 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase): ...@@ -289,7 +277,6 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase):
""" """
We will put default values for an inventory We will put default values for an inventory
""" """
portal = self.getPortal()
date = DateTime(self.second_date_string) date = DateTime(self.second_date_string)
inventory = self.createInventory(start_date=date,sequence=sequence) inventory = self.createInventory(start_date=date,sequence=sequence)
quantity = self.default_quantity - 10 quantity = self.default_quantity - 10
...@@ -395,7 +382,6 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase): ...@@ -395,7 +382,6 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase):
- size/Child/32 99 item1,item2 - size/Child/32 99 item1,item2
- size/Child/34 100 item1,item2 - size/Child/34 100 item1,item2
""" """
portal = self.getPortal()
date = DateTime(self.first_date_string) date = DateTime(self.first_date_string)
inventory = self.createInventory(start_date=date,sequence=sequence) inventory = self.createInventory(start_date=date,sequence=sequence)
quantity = self.default_quantity quantity = self.default_quantity
...@@ -439,7 +425,7 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase): ...@@ -439,7 +425,7 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase):
to_date=date, to_date=date,
sub_variation_text=sub_variation_text) sub_variation_text=sub_variation_text)
self.assertEquals(total_quantity,quantity) self.assertEquals(total_quantity,quantity)
def stepCheckExplanationTextInInventoryList(self, start_date=None, def stepCheckExplanationTextInInventoryList(self, start_date=None,
quantity=None, sequence=None, **kw): quantity=None, sequence=None, **kw):
"""Tests getExplanationText from InventoryBrain """Tests getExplanationText from InventoryBrain
...@@ -458,7 +444,7 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase): ...@@ -458,7 +444,7 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase):
'getExplanationText', 'getExplanationText',
0, 0,
'dummy_selection_name'), '') 'dummy_selection_name'), '')
def stepCreateSecondVariatedAggregatedInventory(self, sequence=None, def stepCreateSecondVariatedAggregatedInventory(self, sequence=None,
sequence_list=None, **kw): sequence_list=None, **kw):
""" """
...@@ -468,7 +454,6 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase): ...@@ -468,7 +454,6 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase):
- size/Child/32 89 item1 - size/Child/32 89 item1
- size/Child/34 90 item1 - size/Child/34 90 item1
""" """
portal = self.getPortal()
date = DateTime(self.second_date_string) date = DateTime(self.second_date_string)
inventory = self.createInventory(start_date=date,sequence=sequence) inventory = self.createInventory(start_date=date,sequence=sequence)
quantity = self.default_quantity - 10 quantity = self.default_quantity - 10
...@@ -563,4 +548,3 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase): ...@@ -563,4 +548,3 @@ class TestInventoryModule(TestOrderMixin, ERP5TypeTestCase):
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self) sequence_list.play(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