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