Commit 029e0341 authored by Jérome Perrin's avatar Jérome Perrin

testInvoice: Use new way of split & defer

This shows new problems. The splitted movement have an accepted quantity of 0,
so nothing is expanded below, and no accounting is built. This is the cause of
test_13_SplitAndDeferInvoice failure.
Also, existing applied rules cannot be expanded anymore because they try to
generate a profit & loss movement.
parent 9631f4fc
...@@ -45,6 +45,14 @@ from Products.ERP5Type.tests.Sequence import SequenceList ...@@ -45,6 +45,14 @@ from Products.ERP5Type.tests.Sequence import SequenceList
from testPackingList import TestPackingListMixin from testPackingList import TestPackingListMixin
from Products.ERP5.tests.utils import newSimulationExpectedFailure from Products.ERP5.tests.utils import newSimulationExpectedFailure
class FakeFormBoxEditor(dict):
# acts as a FormBoxEditor
__allow_access_to_unprotected_subobjects__ = 1
def as_dict(self):
return self
class TestInvoiceMixin(TestPackingListMixin): class TestInvoiceMixin(TestPackingListMixin):
"""Test methods for invoices """Test methods for invoices
""" """
...@@ -895,16 +903,39 @@ class TestInvoiceMixin(TestPackingListMixin): ...@@ -895,16 +903,39 @@ class TestInvoiceMixin(TestPackingListMixin):
split and defer at the invoice level split and defer at the invoice level
""" """
invoice = sequence.get('invoice') invoice = sequence.get('invoice')
kw = {'listbox':[ # solve divergence action is in the menu
{'listbox_key':line.getRelativeUrl(), self.assertTrue('solve_divergence_action' in [action['id'] for action in
'choice':'SplitAndDefer'} for line in invoice.getMovementList()]} self.portal.portal_actions.listFilteredActionsFor(invoice)['workflow']])
self.portal.portal_workflow.doActionFor(
invoice, decision_list = invoice.Delivery_getSolverDecisionList()
'split_and_defer_action',
# Check that the tester provides "Quantity Split Solver" and this solver
# uses FIFO Delivery Solver
solver_decision, = decision_list
tester = solver_decision.getCausalityValue()
self.assertEquals('Net Converted Quantity Divergence Tester',
tester.getPortalType())
self.assertTrue('portal_solvers/Quantity Split Solver'
in tester.getSolverList())
self.assertTrue('portal_solvers/FIFO Delivery Solver' in
self.portal.portal_solvers['Quantity Split Solver'].getDeliverySolverList())
# Content of the formbox
solver_configuration = FakeFormBoxEditor(
start_date=self.datetime + 15, start_date=self.datetime + 15,
stop_date=self.datetime + 25, stop_date=self.datetime + 25,
**kw) delivery_solver='FIFO Delivery Solver')
pass
invoice.Delivery_submitSolveDivergenceDialog(listbox=[{
'comment': '',
'solver': 'portal_solvers/Quantity Split Solver',
'listbox_key': solver_decision.getPath(),
'solver_configuration': solver_configuration, }])
# TODO: solving divergence could trigger the building alarm
self.tic()
self.stepInvoiceBuilderAlarm()
self.tic()
def stepUnifyStartDateWithDecisionInvoice(self, sequence=None, def stepUnifyStartDateWithDecisionInvoice(self, sequence=None,
sequence_list=None): sequence_list=None):
......
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