Commit 518fbca5 authored by Jérome Perrin's avatar Jérome Perrin

tests: update test now that we don't have split_and_defer_action

Use the solve divergence action to achieve the same.
parent f8e22924
Pipeline #9784 failed with stage
in 0 seconds
...@@ -569,6 +569,8 @@ class TestAdvancedSaleInvoice(TestAdvancedInvoice): ...@@ -569,6 +569,8 @@ class TestAdvancedSaleInvoice(TestAdvancedInvoice):
stepCheckInvoiceIsDiverged stepCheckInvoiceIsDiverged
stepSplitAndDeferInvoice stepSplitAndDeferInvoice
stepTic stepTic
stepInvoiceBuilderAlarm
stepTic
stepCheckInvoiceIsNotDivergent stepCheckInvoiceIsNotDivergent
stepCheckInvoiceIsSolved stepCheckInvoiceIsSolved
...@@ -822,6 +824,8 @@ class TestAdvancedSaleInvoice(TestAdvancedInvoice): ...@@ -822,6 +824,8 @@ class TestAdvancedSaleInvoice(TestAdvancedInvoice):
stepTic stepTic
stepDeliverInvoice stepDeliverInvoice
stepTic stepTic
stepInvoiceBuilderAlarm
stepTic
stepCheckInvoiceIsNotDivergent stepCheckInvoiceIsNotDivergent
stepCheckInvoiceIsSolved stepCheckInvoiceIsSolved
stepCheckInvoiceSplitted stepCheckInvoiceSplitted
......
...@@ -888,19 +888,19 @@ class TestInvoiceMixin(TestPackingListMixin): ...@@ -888,19 +888,19 @@ class TestInvoiceMixin(TestPackingListMixin):
def stepSplitAndDeferInvoice(self, sequence=None, sequence_list=None, def stepSplitAndDeferInvoice(self, sequence=None, sequence_list=None,
**kw): **kw):
"""
split and defer at the invoice level
"""
invoice = sequence.get('invoice') invoice = sequence.get('invoice')
kw = {'listbox':[ solver_process = self.portal.portal_solver_processes.newSolverProcess(invoice)
{'listbox_key':line.getRelativeUrl(), quantity_solver_decision, = [x for x in solver_process.contentValues()
'choice':'SplitAndDefer'} for line in invoice.getMovementList()]} if x.getCausalityValue().getTestedProperty() == 'quantity']
self.portal.portal_workflow.doActionFor( # use Quantity Split Solver.
invoice, quantity_solver_decision.setSolverValue(self.portal.portal_solvers['Quantity Split Solver'])
'split_and_defer_action', # configure for Quantity Split Solver.
start_date=self.datetime + 15, kw = {'delivery_solver':'FIFO Delivery Solver',
stop_date=self.datetime + 25, 'start_date':self.datetime + 15,
**kw) 'stop_date':self.datetime + 25}
quantity_solver_decision.updateConfiguration(**kw)
solver_process.buildTargetSolverList()
solver_process.solve()
def stepUnifyStartDateWithDecisionInvoice(self, sequence=None, def stepUnifyStartDateWithDecisionInvoice(self, sequence=None,
sequence_list=None): sequence_list=None):
...@@ -3001,6 +3001,8 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase): ...@@ -3001,6 +3001,8 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
stepCheckInvoiceIsDiverged stepCheckInvoiceIsDiverged
stepSplitAndDeferInvoice stepSplitAndDeferInvoice
stepTic stepTic
stepInvoiceBuilderAlarm
stepTic
stepCheckInvoiceIsNotDivergent stepCheckInvoiceIsNotDivergent
stepCheckInvoiceIsSolved stepCheckInvoiceIsSolved
......
...@@ -336,19 +336,18 @@ class TestPackingListMixin(TestOrderMixin): ...@@ -336,19 +336,18 @@ class TestPackingListMixin(TestOrderMixin):
def stepSplitAndDeferDoNothingPackingList(self, sequence=None, sequence_list=None, **kw): def stepSplitAndDeferDoNothingPackingList(self, sequence=None, sequence_list=None, **kw):
""" """
Do the split and defer action, but choose "do nothing" for divergences Do the solve divrgence action, but choose "do nothing" for divergences
""" """
packing_list = sequence.get('packing_list') packing_list = sequence.get('packing_list')
kw = {'listbox':[ solver_process = self.portal.portal_solver_processes.newSolverProcess(packing_list)
{'listbox_key':line.getRelativeUrl(), quantity_solver_decision, = [x for x in solver_process.contentValues()
'choice':'ignore'} for line in packing_list.getMovementList() if x.getCausalityValue().getTestedProperty() == 'quantity']
if line.isDivergent()]} # use no solver
self.portal.portal_workflow.doActionFor( quantity_solver_decision.setSolverValue(None)
packing_list, # and no configure
'split_and_defer_action', quantity_solver_decision.updateConfiguration()
start_date=self.datetime + 15, solver_process.buildTargetSolverList()
stop_date=self.datetime + 25, solver_process.solve()
**kw)
def stepCheckPackingListSplitted(self, sequence=None, sequence_list=None, **kw): def stepCheckPackingListSplitted(self, sequence=None, sequence_list=None, **kw):
""" """
......
...@@ -668,19 +668,24 @@ class TestTradeModelLine(TestTradeModelLineMixin): ...@@ -668,19 +668,24 @@ class TestTradeModelLine(TestTradeModelLineMixin):
self.checkTradeModelRuleSimulationExpand(order) self.checkTradeModelRuleSimulationExpand(order)
self.copyExpectedAmountDict(packing_list, self.copyExpectedAmountDict(packing_list,
self.modified_packing_list_line_quantity_ratio) self.modified_packing_list_line_quantity_ratio)
solver_process = self.portal.portal_solver_processes.newSolverProcess(packing_list)
listbox = [{'listbox_key':line.getRelativeUrl(), quantity_solver_decision_list = [x for x in solver_process.contentValues()
'choice':'SplitAndDefer'} if x.getCausalityValue().getTestedProperty() == 'quantity']
for line in packing_list.getMovementList() self.assertTrue(quantity_solver_decision_list)
if line.isDivergent()] for quantity_solver_decision in quantity_solver_decision_list:
self.assertEqual(len(order), len(listbox)) # use Quantity Split Solver.
self.portal.portal_workflow.doActionFor( quantity_solver_decision.setSolverValue(self.portal.portal_solvers['Quantity Split Solver'])
packing_list, # configure for Quantity Split Solver.
'split_and_defer_action', kw = {
start_date=packing_list.getStartDate() + 15, 'delivery_solver': 'FIFO Delivery Solver',
stop_date=packing_list.getStopDate() + 25, 'start_date': packing_list.getStartDate() + 15,
listbox=listbox) 'stop_date': packing_list.getStopDate() + 25,
}
quantity_solver_decision.updateConfiguration(**kw)
solver_process.buildTargetSolverList()
solver_process.solve()
self.tic()
self.buildPackingLists()
self.tic() self.tic()
self.checkCausalityState(packing_list, 'solved') self.checkCausalityState(packing_list, 'solved')
new_packing_list, = [x for x in order.getCausalityRelatedValueList( new_packing_list, = [x for x in order.getCausalityRelatedValueList(
......
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