Commit ce3ceca4 authored by Sebastien Robin's avatar Sebastien Robin

new error when we rename the variation


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@965 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 925124a1
...@@ -340,6 +340,7 @@ class TestOrder(ERP5TypeTestCase): ...@@ -340,6 +340,7 @@ class TestOrder(ERP5TypeTestCase):
content_list = resource.contentValues(filter={'portal_type':'Variante Modele'}) content_list = resource.contentValues(filter={'portal_type':'Variante Modele'})
# Rename the first variation # Rename the first variation
variation = content_list[0] variation = content_list[0]
#variation.setId('renamed_' + variation.getId())
variation.setId('renamed_' + variation.getId()) variation.setId('renamed_' + variation.getId())
variation_category_list = ('coloris/modele/%s/%s' % (resource.getId(),content_list[0].getId()), variation_category_list = ('coloris/modele/%s/%s' % (resource.getId(),content_list[0].getId()),
'coloris/modele/%s/%s' % (resource.getId(),content_list[1].getId()), 'coloris/modele/%s/%s' % (resource.getId(),content_list[1].getId()),
...@@ -351,7 +352,7 @@ class TestOrder(ERP5TypeTestCase): ...@@ -351,7 +352,7 @@ class TestOrder(ERP5TypeTestCase):
sequence.edit(size_list=size_list) sequence.edit(size_list=size_list)
sequence.edit(renamed_variation=1) sequence.edit(renamed_variation=1)
color_and_size_list = [] color_and_size_list = []
# This define (('coloris/modele/1/1,taille/adulte/40',('coloris/modele/1/1',taille/adulte/42)...) # This define (('coloris/modele/1/1,taille/adulte/40'),('coloris/modele/1/1',taille/adulte/42)...)
for c in color_list: for c in color_list:
for s in size_list: for s in size_list:
color_and_size_list.append((c,s)) color_and_size_list.append((c,s))
...@@ -375,7 +376,7 @@ class TestOrder(ERP5TypeTestCase): ...@@ -375,7 +376,7 @@ class TestOrder(ERP5TypeTestCase):
cell_list = sales_order_line.objectValues() cell_list = sales_order_line.objectValues()
self.assertEquals(len(cell_list),4) self.assertEquals(len(cell_list),4)
for cell in cell_list: for cell in cell_list:
cell.setQuantity(self.quantity) cell.setTargetQuantity(self.quantity)
cell.setPrice(self.base_price1) cell.setPrice(self.base_price1)
# See what's the output of Order_lightControl # See what's the output of Order_lightControl
result=sales_order.Order_lightControl() result=sales_order.Order_lightControl()
...@@ -422,13 +423,21 @@ class TestOrder(ERP5TypeTestCase): ...@@ -422,13 +423,21 @@ class TestOrder(ERP5TypeTestCase):
def stepUserGetReadyPackingList(self, sequence=None,sequence_list=None): def stepUserGetReadyPackingList(self, sequence=None,sequence_list=None):
packing_list = sequence.get('packing_list') packing_list = sequence.get('packing_list')
LOG('stepAcceptDeliveryPackingList, packing_list.asXML()',0,packing_list.asXML())
packing_list.portal_workflow.doActionFor(packing_list,'user_get_ready', packing_list.portal_workflow.doActionFor(packing_list,'user_get_ready',
wf_id='delivery_workflow') wf_id='delivery_workflow')
def stepUserSetReadyPackingList(self, sequence=None,sequence_list=None):
packing_list = sequence.get('packing_list')
packing_list.portal_workflow.doActionFor(packing_list,'user_set_ready',
wf_id='delivery_workflow')
def stepUserStartPackingList(self, sequence=None,sequence_list=None):
packing_list = sequence.get('packing_list')
packing_list.portal_workflow.doActionFor(packing_list,'user_start',
wf_id='delivery_workflow')
def stepUserConfirmPackingList(self, sequence=None,sequence_list=None): def stepUserConfirmPackingList(self, sequence=None,sequence_list=None):
packing_list = sequence.get('packing_list') packing_list = sequence.get('packing_list')
LOG('UserConfirmPackingList packing_list.asXML()',0, packing_list.asXML())
packing_list.portal_workflow.doActionFor(packing_list,'user_confirm', packing_list.portal_workflow.doActionFor(packing_list,'user_confirm',
wf_id='delivery_workflow') wf_id='delivery_workflow')
...@@ -445,7 +454,6 @@ class TestOrder(ERP5TypeTestCase): ...@@ -445,7 +454,6 @@ class TestOrder(ERP5TypeTestCase):
def stepCheckConfirmSalesOrder(self, sequence=None, sequence_list=None, **kw): def stepCheckConfirmSalesOrder(self, sequence=None, sequence_list=None, **kw):
sales_order = sequence.get('sales_order') sales_order = sequence.get('sales_order')
LOG('sales_order.showDict',0,sales_order.showDict())
sales_order_line = sales_order._getOb('1') sales_order_line = sales_order._getOb('1')
simulation_tool = self.getSimulationTool() simulation_tool = self.getSimulationTool()
simulation_object_list = simulation_tool.objectValues() simulation_object_list = simulation_tool.objectValues()
...@@ -469,6 +477,7 @@ class TestOrder(ERP5TypeTestCase): ...@@ -469,6 +477,7 @@ class TestOrder(ERP5TypeTestCase):
self.assertEquals(len(line_list),1) self.assertEquals(len(line_list),1)
self.assertEquals(line.getQuantity(),self.quantity) self.assertEquals(line.getQuantity(),self.quantity)
else: else:
LOG('CheckConfirmSalesOrder line.asXML',0,line.asXML())
self.assertEquals(len(line_list),4) self.assertEquals(len(line_list),4)
# Check if the order of each line of the simulation # Check if the order of each line of the simulation
# object is a cell of the order # object is a cell of the order
...@@ -479,7 +488,17 @@ class TestOrder(ERP5TypeTestCase): ...@@ -479,7 +488,17 @@ class TestOrder(ERP5TypeTestCase):
self.failIfDifferentSet(cell_list,order_list) self.failIfDifferentSet(cell_list,order_list)
color_and_size_list = sequence.get('color_and_size_list') color_and_size_list = sequence.get('color_and_size_list')
cell_color_and_size_list = map(lambda x: x.getCategoryList(),cell_list) cell_color_and_size_list = map(lambda x: x.getCategoryList(),cell_list)
LOG('stepCheckConfirmSalesOrder color_and_size_list',0,color_and_size_list)
LOG('stepCheckConfirmSalesOrder cell_color_and_size_list',0,cell_color_and_size_list)
self.failIfDifferentSet(color_and_size_list,cell_color_and_size_list) self.failIfDifferentSet(color_and_size_list,cell_color_and_size_list)
for cell in cell_list:
LOG('CheckConfirmSalesOrder cell.asXML',0,cell.asXML())
self.assertEquals(cell.getTargetQuantity(),self.quantity)
# Check membership criterion
membership_criterion_category_list = map(lambda x: tuple(x.getMembershipCriterionCategoryList()),cell_list)
LOG('stepCheckActivateRequirementList, color_and_size_list',0,color_and_size_list)
LOG('stepCheckActivateRequirementList, membership_criterion_category_list',0,membership_criterion_category_list)
self.failIfDifferentSet(color_and_size_list,membership_criterion_category_list)
def stepCheckPackingListDiverged(self, sequence=None, sequence_list=None, **kw): def stepCheckPackingListDiverged(self, sequence=None, sequence_list=None, **kw):
packing_list = sequence.get('packing_list') packing_list = sequence.get('packing_list')
...@@ -534,9 +553,45 @@ class TestOrder(ERP5TypeTestCase): ...@@ -534,9 +553,45 @@ class TestOrder(ERP5TypeTestCase):
self.assertEquals(len(line.objectValues()),0) self.assertEquals(len(line.objectValues()),0)
else: else:
cell_list = line.objectValues() cell_list = line.objectValues()
# check variation_base_category_list
self.failIfDifferentSet(line.getVariationBaseCategoryList(),self.variation_base_category_list1)
LOG('stepCheckActivateRequirementList, line.asXML',0,line.asXML())
self.assertEquals(len(cell_list),4) self.assertEquals(len(cell_list),4)
for cell in cell_list: for cell in cell_list:
LOG('stepCheckActivateRequirementList, cell.getCategoryList',0,cell.getCategoryList()) LOG('stepCheckActivateRequirementList, cell.getCategoryList',0,cell.getCategoryList())
self.assertEquals(cell.getTargetQuantity(),self.quantity)
color_and_size_list = sequence.get('color_and_size_list')
membership_criterion_category_list = map(lambda x: tuple(x.getMembershipCriterionCategoryList()),cell_list)
LOG('stepCheckActivateRequirementList, color_and_size_list',0,color_and_size_list)
LOG('stepCheckActivateRequirementList, membership_criterion_category_list',0,membership_criterion_category_list)
self.failIfDifferentSet(color_and_size_list,membership_criterion_category_list)
def stepCheckSplittedAndDefferedPackingList(self, sequence=None, sequence_list=None, **kw):
packing_list_module = self.getSalesPackingListModule()
sales_order = sequence.get('sales_order')
packing_list_list = packing_list_module.objectValues()
packing_list = None
related_list = []
for o in packing_list_list:
if o.getCausalityValue()==sales_order:
related_list.append(o)
self.assertEquals(len(related_list),2)
def sort_by_id(x,y):
return cmp(int(x.getId()),int(y.getId()))
# Like this we will have the related_list sorted
# by the order where the packing list where created
related_list.sort(sort_by_id)
packing_list1 = related_list[0] # The First one
line = packing_list1.objectValues()[0]
for cell in line.objectValues():
self.assertEquals(cell.getTargetQuantity(),self.quantity-1)
packing_list2 = related_list[1] # The First one
line = packing_list2.objectValues()[0]
for cell in line.objectValues():
self.assertEquals(cell.getTargetQuantity(),1)
def stepAddLinesToSalesPackingList(self, sequence=None, sequence_list=None, **kw): def stepAddLinesToSalesPackingList(self, sequence=None, sequence_list=None, **kw):
packing_list = sequence.get('packing_list') packing_list = sequence.get('packing_list')
...@@ -572,16 +627,16 @@ class TestOrder(ERP5TypeTestCase): ...@@ -572,16 +627,16 @@ class TestOrder(ERP5TypeTestCase):
# We create a sales order, confirm and then make sure the corresponding # We create a sales order, confirm and then make sure the corresponding
# packing list is made # packing list is made
# ... OK # ... OK
sequence_string = 'AddSalesOrder PlanSalesOrder OrderSalesOrder ConfirmSalesOrder' \ #sequence_string = 'AddSalesOrder PlanSalesOrder OrderSalesOrder ConfirmSalesOrder' \
+ ' Tic Tic Tic Tic CheckConfirmSalesOrder' \ # + ' Tic Tic Tic Tic CheckConfirmSalesOrder' \
+ ' Tic Tic CheckActivateRequirementList' # + ' Tic Tic CheckActivateRequirementList'
sequence_list.addSequenceString(sequence_string) #sequence_list.addSequenceString(sequence_string)
# Simple sequence (same as the previous one) with only some tic when it is required and with no plan, # Simple sequence (same as the previous one) with only some tic when it is required and with no plan,
# ... OK # ... OK
sequence_string = 'AddSalesOrder Tic ConfirmSalesOrder Tic CheckConfirmSalesOrder ' \ #sequence_string = 'AddSalesOrder Tic ConfirmSalesOrder Tic CheckConfirmSalesOrder ' \
+ 'Tic CheckActivateRequirementList' # + 'Tic CheckActivateRequirementList'
sequence_list.addSequenceString(sequence_string) #sequence_list.addSequenceString(sequence_string)
# Sequence where we set less quantity in the packing list # Sequence where we set less quantity in the packing list
# And we want to be sure that we will have less quantity in the simulation after we did accept # And we want to be sure that we will have less quantity in the simulation after we did accept
...@@ -596,14 +651,14 @@ class TestOrder(ERP5TypeTestCase): ...@@ -596,14 +651,14 @@ class TestOrder(ERP5TypeTestCase):
# We create a sales order, confirm and then make sure the corresponding # We create a sales order, confirm and then make sure the corresponding
# packing list is made # packing list is made
# ... OK # ... OK
sequence_string = 'AddVariatedSalesOrder PlanSalesOrder OrderSalesOrder' \ #sequence_string = 'AddVariatedSalesOrder PlanSalesOrder OrderSalesOrder' \
+ ' ConfirmSalesOrder Tic Tic Tic Tic CheckConfirmSalesOrder' \ # + ' ConfirmSalesOrder Tic Tic Tic Tic CheckConfirmSalesOrder' \
+ ' Tic Tic CheckActivateRequirementList' # + ' Tic Tic CheckActivateRequirementList'
sequence_list.addSequenceString(sequence_string) #sequence_list.addSequenceString(sequence_string)
# Sequence where we confirm an order, the corresponding packing list is automatically # Sequence where we confirm an order, the corresponding packing list is automatically
# created, then we add new lines to the packing list by hand, we accept, we then check # created, then we add new lines to the packing list by hand, we accept, we then check
# if the packing list if converged. # if the packing list is converged.
# ... FAILS # ... FAILS
#sequence_string = 'AddSalesOrder Tic Tic ConfirmSalesOrder Tic Tic CheckConfirmSalesOrder Tic' \ #sequence_string = 'AddSalesOrder Tic Tic ConfirmSalesOrder Tic Tic CheckConfirmSalesOrder Tic' \
# + ' Tic Tic Tic Tic Tic Tic CheckConfirmSalesOrder' \ # + ' Tic Tic Tic Tic Tic Tic CheckConfirmSalesOrder' \
...@@ -615,12 +670,12 @@ class TestOrder(ERP5TypeTestCase): ...@@ -615,12 +670,12 @@ class TestOrder(ERP5TypeTestCase):
# created, then we rename the color of the variated resource, everything should take # created, then we rename the color of the variated resource, everything should take
# into account the new name # into account the new name
# ... FAILS # ... FAILS
#sequence_string = 'AddVariatedSalesOrder PlanSalesOrder OrderSalesOrder' \ sequence_string = 'AddVariatedSalesOrder PlanSalesOrder OrderSalesOrder' \
# + ' ConfirmSalesOrder Tic Tic Tic Tic CheckConfirmSalesOrder' \ + ' ConfirmSalesOrder Tic Tic Tic Tic CheckConfirmSalesOrder' \
# + ' Tic Tic CheckActivateRequirementList' \ + ' Tic Tic CheckActivateRequirementList' \
# + ' Tic Tic ModifyVariationId CheckConfirmSalesOrder' \ + ' Tic Tic ModifyVariationId Tic Tic CheckConfirmSalesOrder' \
# + ' Tic Tic CheckActivateRequirementList' + ' Tic Tic CheckActivateRequirementList'
#sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
# Sequence where we create an order, then the color is renamed, then we confirm # Sequence where we create an order, then the color is renamed, then we confirm
# and we look if everyhing is going fine on the simulation and that the # and we look if everyhing is going fine on the simulation and that the
...@@ -634,17 +689,31 @@ class TestOrder(ERP5TypeTestCase): ...@@ -634,17 +689,31 @@ class TestOrder(ERP5TypeTestCase):
# Sequence where we confirm an order, the corresponding packing list is automatically # Sequence where we confirm an order, the corresponding packing list is automatically
# created, then we wants to only send one part of the packing list and finally # created, then we wants to only send one part of the packing list and finally
# we split and defer the packing list # we split and defer the packing list
# ... ??? # ... OK
sequence_string = 'AddVariatedSalesOrder PlanSalesOrder OrderSalesOrder' \ #sequence_string = 'AddVariatedSalesOrder PlanSalesOrder OrderSalesOrder' \
+ ' ConfirmSalesOrder Tic Tic Tic Tic CheckConfirmSalesOrder' \ # + ' ConfirmSalesOrder Tic Tic Tic Tic CheckConfirmSalesOrder' \
+ ' CheckActivateRequirementList Tic Tic Tic' \ # + ' CheckActivateRequirementList Tic Tic Tic' \
+ ' UserGetReadyPackingList Tic Tic SplitAndDeferPackingList Tic Tic' \ # + ' UserGetReadyPackingList Tic Tic UserSetReadyPackingList Tic Tic' \
+ ' AcceptDeliveryPackingList Tic Tic' # + ' UserStartPackingList Tic Tic Tic Tic' \
sequence_list.addSequenceString(sequence_string) # + ' AcceptDeliveryPackingList Tic Tic SplitAndDeferPackingList Tic Tic Tic' \
# + ' CheckSplittedAndDefferedPackingList'
#sequence_list.addSequenceString(sequence_string)
# Sequences with no tic at all can't works # Sequence where we build a Production Order, we confirm this production order, then
# we have many packing list, we change the destination of one of the packing_list,
# we must be sure that this change is taken into account into the simulation
# ... ???
#sequence_string = 'AddVariatedSalesOrder PlanSalesOrder OrderSalesOrder' \
# + ' ConfirmSalesOrder Tic Tic Tic Tic CheckConfirmSalesOrder' \
# + ' CheckActivateRequirementList Tic Tic Tic' \
# + ' UserGetReadyPackingList Tic Tic UserSetReadyPackingList Tic Tic' \
# + ' UserStartPackingList Tic Tic Tic Tic' \
# + ' AcceptDeliveryPackingList Tic Tic SplitAndDeferPackingList Tic Tic Tic' \
# + ' CheckSplittedAndDefferedPackingList'
#sequence_list.addSequenceString(sequence_string) #sequence_list.addSequenceString(sequence_string)
# Now add a non defined sequence # Now add a non defined sequence
# sequence = Sequence() # sequence = Sequence()
# sequence.addStep('AddSalesOrder') # sequence.addStep('AddSalesOrder')
......
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