Commit 3ed9f6ae authored by Sebastien Robin's avatar Sebastien Robin

improve the way of reseting inventories

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14095 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 59f4dcca
...@@ -900,7 +900,8 @@ class TestERP5BankingMixin: ...@@ -900,7 +900,8 @@ class TestERP5BankingMixin:
price = movement_line.getResourceValue().getBasePrice()) price = movement_line.getResourceValue().getBasePrice())
def createCashInventory(self, source, destination, currency, line_list=[],extra_id=''): def createCashInventory(self, source, destination, currency, line_list=[],extra_id='',
reset_quantity=0):
""" """
Create a cash inventory group Create a cash inventory group
""" """
...@@ -942,7 +943,8 @@ class TestERP5BankingMixin: ...@@ -942,7 +943,8 @@ class TestERP5BankingMixin:
line['variation_id'], line['variation_id'],
line['variation_value'], line['variation_value'],
line['quantity'], line['quantity'],
variation_list=variation_list) variation_list=variation_list,
reset_quantity=reset_quantity)
# deliver the inventory # deliver the inventory
if inventory.getSimulationState()!='delivered': if inventory.getSimulationState()!='delivered':
inventory.deliver() inventory.deliver()
...@@ -951,7 +953,7 @@ class TestERP5BankingMixin: ...@@ -951,7 +953,7 @@ class TestERP5BankingMixin:
def addCashLineToDelivery(self, delivery_object, line_id, line_portal_type, resource_object, def addCashLineToDelivery(self, delivery_object, line_id, line_portal_type, resource_object,
variation_base_category_list, variation_category_list, resource_quantity_dict, variation_base_category_list, variation_category_list, resource_quantity_dict,
variation_list=None): variation_list=None, reset_quantity=0):
""" """
Add a cash line to a delivery Add a cash line to a delivery
""" """
...@@ -986,7 +988,10 @@ class TestERP5BankingMixin: ...@@ -986,7 +988,10 @@ class TestERP5BankingMixin:
v1, v2 = variation_category_list[:2] v1, v2 = variation_category_list[:2]
cell = line.getCell(v1, variation, v2) cell = line.getCell(v1, variation, v2)
if cell is not None: if cell is not None:
cell.setQuantity(resource_quantity_dict[variation]) quantity = resource_quantity_dict[variation]
if reset_quantity:
quantity = 0
cell.setQuantity(quantity)
def checkResourceCreated(self): def checkResourceCreated(self):
...@@ -1036,11 +1041,8 @@ class TestERP5BankingMixin: ...@@ -1036,11 +1041,8 @@ class TestERP5BankingMixin:
else: else:
extra_id = '_reset' extra_id = '_reset'
# Before the test, we need to input the inventory # Before the test, we need to input the inventory
for line in line_list:
for variation in line['quantity'].keys():
line['quantity'][variation] = 0
self.createCashInventory(source=None, destination=destination, currency=currency, self.createCashInventory(source=None, destination=destination, currency=currency,
line_list=line_list,extra_id=extra_id) line_list=line_list,extra_id=extra_id, reset_quantity=1)
def stepDeleteResetInventory(self, sequence=None, sequence_list=None, **kwd): def stepDeleteResetInventory(self, sequence=None, sequence_list=None, **kwd):
""" """
......
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