Commit 9631f4fc authored by Jérome Perrin's avatar Jérome Perrin

remove "quiet" from testInvoice

parent 119ee4a3
......@@ -152,10 +152,10 @@ class TestInvoiceMixin(TestPackingListMixin):
pass # see createBusinessProcess
## XXX move this to "Sequence class"
def playSequence(self, sequence_string, quiet=0) :
def playSequence(self, sequence_string):
sequence_list = SequenceList()
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self, quiet=quiet)
sequence_list.play(self)
def createBusinessProcess(self):
portal = self.portal
......@@ -1131,7 +1131,6 @@ class TestInvoice(TestInvoiceMixin):
"""Test methods for sale and purchase invoice.
Subclasses must defines portal types to use.
"""
quiet = 1
def test_invoice_transaction_line_resource(self):
"""
tests that simulation movements corresponding to accounting line have a
......@@ -2311,11 +2310,10 @@ self.portal.getDefaultModule(self.packing_list_portal_type).newContent(
print invoice, divergence_list
self._solveDivergence(invoice, 'quantity', 'Accept Solver')
def test_accept_quantity_divergence_on_invoice_with_stopped_packing_list(
self, quiet=quiet):
def test_accept_quantity_divergence_on_invoice_with_stopped_packing_list(self):
sequence_list = SequenceList()
sequence = sequence_list.addSequenceString(self.PACKING_LIST_DEFAULT_SEQUENCE)
sequence_list.play(self, quiet=quiet)
sequence_list.play(self)
packing_list = sequence.get('packing_list')
packing_list_line = packing_list.getMovementList()[0]
......@@ -2367,12 +2365,11 @@ self.portal.getDefaultModule(self.packing_list_portal_type).newContent(
print invoice, divergence_list
self._solveDivergence(invoice, 'quantity', 'Adopt Solver')
def test_adopt_quantity_divergence_on_invoice_line_with_stopped_packing_list(
self, quiet=quiet):
def test_adopt_quantity_divergence_on_invoice_line_with_stopped_packing_list(self):
# #1053
sequence_list = SequenceList()
sequence = sequence_list.addSequenceString(self.PACKING_LIST_DEFAULT_SEQUENCE)
sequence_list.play(self, quiet=quiet)
sequence_list.play(self)
packing_list = sequence.get('packing_list')
packing_list_line = packing_list.getMovementList()[0]
......@@ -2452,7 +2449,6 @@ class TestSaleInvoiceMixin(TestInvoiceMixin,
Those tests methods only work for sale, because sale and purchase invoice
are not built at the same time on packing list workflow.
"""
quiet = 0
invoice_portal_type = 'Sale Invoice Transaction'
invoice_line_portal_type = 'Invoice Line'
invoice_cell_portal_type = 'Invoice Cell'
......@@ -2566,7 +2562,6 @@ class TestSaleInvoiceMixin(TestInvoiceMixin,
class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
"""Tests for sale invoice.
"""
quiet = 0
# fix inheritance
login = TestInvoiceMixin.login
......@@ -2578,12 +2573,10 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
getNeededCategoryList = TestInvoiceMixin.getNeededCategoryList
def test_01_SimpleInvoice(self, quiet=quiet):
def test_SimpleInvoice(self):
"""
Checks that a Simple Invoice is created from a Packing List
"""
if not quiet:
self.logMessage('Simple Invoice')
sequence_list = SequenceList()
for base_sequence in (self.PACKING_LIST_DEFAULT_SEQUENCE, ) :
sequence_list.addSequenceString(
......@@ -2601,9 +2594,9 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
stepCheckInvoicesConsistency
stepCheckInvoiceLineHasReferenceAndIntIndex
""")
sequence_list.play(self, quiet=quiet)
sequence_list.play(self)
def test_02_TwoInvoicesFromTwoPackingList(self, quiet=quiet):
def test_TwoInvoicesFromTwoPackingList(self):
"""
This test was created for the following bug:
- an order is created and confirmed
......@@ -2614,7 +2607,6 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
so we have an invoice with twice the number of accounting rules
and an invoice with no accounting rules. both invoices are wrong
"""
if not quiet: self.logMessage('Two Invoices from Two Packing List')
sequence_list = SequenceList()
for base_sequence in (self.TWO_PACKING_LIST_DEFAULT_SEQUENCE, ) :
sequence_list.addSequenceString(
......@@ -2637,9 +2629,9 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
stepCheckTwoInvoicesTransactionLines
stepCheckInvoicesConsistency
""")
sequence_list.play(self, quiet=quiet)
sequence_list.play(self)
def test_03_InvoiceEditAndInvoiceRule(self, quiet=quiet):
def test_03_InvoiceEditAndInvoiceRule(self):
"""
Invoice Rule should not be applied on invoice lines created from\
Packing List.
......@@ -2651,8 +2643,6 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
- A new Invoice Rule is created for this invoice, and accounting
movements for this invoice are present twice in the simulation.
"""
if not quiet:
self.logMessage('Invoice Edit')
sequence_list = SequenceList()
for base_sequence in (self.PACKING_LIST_DEFAULT_SEQUENCE, ) :
sequence_list.addSequenceString(
......@@ -2671,15 +2661,13 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
stepCheckInvoiceRuleNotAppliedOnInvoiceEdit
stepCheckInvoicesConsistency
""")
sequence_list.play(self, quiet=quiet)
sequence_list.play(self)
def test_04_PackingListEditAndInvoiceRule(self, quiet=quiet):
def test_04_PackingListEditAndInvoiceRule(self):
"""
Delivery Rule should not be applied on packing list lines created\
from Order.
"""
if not quiet:
self.logMessage('Packing List Edit')
sequence_list = SequenceList()
for base_sequence in (self.PACKING_LIST_DEFAULT_SEQUENCE, ) :
sequence_list.addSequenceString(
......@@ -2689,15 +2677,13 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
stepTic
stepCheckDeliveryRuleNotAppliedOnPackingListEdit
""")
sequence_list.play(self, quiet=quiet)
sequence_list.play(self)
def test_05_InvoiceEditPackingListLine(self, quiet=quiet):
def test_05_InvoiceEditPackingListLine(self):
"""
Checks that editing a Packing List Line still creates a correct
Invoice
"""
if not quiet:
self.logMessage('Packing List Line Edit')
sequence_list = SequenceList()
for base_sequence in (self.PACKING_LIST_DEFAULT_SEQUENCE, ) :
sequence_list.addSequenceString(
......@@ -2715,15 +2701,13 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
stepRebuildAndCheckNothingIsCreated
stepCheckInvoicesConsistency
""")
sequence_list.play(self, quiet=quiet)
sequence_list.play(self)
def test_06_InvoiceDeletePackingListLine(self, quiet=quiet):
def test_06_InvoiceDeletePackingListLine(self):
"""
Checks that deleting a Packing List Line still creates a correct
Invoice
"""
if not quiet:
self.logMessage('Packing List Line Delete')
sequence_list = SequenceList()
for base_sequence in (self.PACKING_LIST_TWO_LINES_DEFAULT_SEQUENCE, ) :
sequence_list.addSequenceString(
......@@ -2742,15 +2726,13 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
stepCheckInvoicesConsistency
stepTic
""")
sequence_list.play(self, quiet=quiet)
sequence_list.play(self)
def test_07_InvoiceAddPackingListLine(self, quiet=quiet):
def test_07_InvoiceAddPackingListLine(self):
"""
Checks that adding a Packing List Line still creates a correct
Invoice
"""
if not quiet:
self.logMessage('Packing List Line Add')
sequence_list = SequenceList()
for base_sequence in (self.PACKING_LIST_DEFAULT_SEQUENCE,
self.PACKING_LIST_TWO_LINES_DEFAULT_SEQUENCE) :
......@@ -2772,16 +2754,14 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
stepRebuildAndCheckNothingIsCreated
stepCheckInvoicesConsistency
""")
sequence_list.play(self, quiet=quiet)
sequence_list.play(self)
def test_08_InvoiceDecreaseQuantity(self, quiet=quiet):
def test_08_InvoiceDecreaseQuantity(self):
"""
Change the quantity of a Invoice Line,
check that the invoice is divergent,
then split and defer, and check everything is solved
"""
if not quiet:
self.logMessage('Invoice Decrease Quantity')
sequence = self.PACKING_LIST_DEFAULT_SEQUENCE + \
"""
stepSetReadyPackingList
......@@ -2813,10 +2793,10 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
stepRebuildAndCheckNothingIsCreated
stepCheckInvoicesConsistency
"""
self.playSequence(sequence, quiet=quiet)
self.playSequence(sequence)
@newSimulationExpectedFailure
def test_09_InvoiceChangeStartDateFail(self, quiet=quiet):
def test_09_InvoiceChangeStartDateFail(self):
"""
Change the start_date of a Invoice Line,
check that the invoice is divergent,
......@@ -2824,8 +2804,6 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
because Unify Solver does not propagage the change to the upper
simulation movement.
"""
if not quiet:
self.logMessage('Invoice Change Start Date')
sequence = self.PACKING_LIST_DEFAULT_SEQUENCE + \
"""
stepSetReadyPackingList
......@@ -2857,18 +2835,16 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
stepRebuildAndCheckNothingIsCreated
stepCheckInvoicesConsistency
"""
self.playSequence(sequence, quiet=quiet)
self.playSequence(sequence)
@newSimulationExpectedFailure
def test_09b_InvoiceChangeStartDateSucceed(self, quiet=quiet):
def test_09b_InvoiceChangeStartDateSucceed(self):
"""
Change the start_date of a Invoice Line,
check that the invoice is divergent,
deliver the Packing List to make sure it's frozen,
then accept decision, and check everything is solved
"""
if not quiet:
self.logMessage('Invoice Change Sart Date')
sequence = self.PACKING_LIST_DEFAULT_SEQUENCE + \
"""
stepSetReadyPackingList
......@@ -2904,17 +2880,15 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
stepRebuildAndCheckNothingIsCreated
stepCheckInvoicesConsistency
"""
self.playSequence(sequence, quiet=quiet)
self.playSequence(sequence)
def test_10_AcceptDecisionOnPackingList(self, quiet=quiet):
def test_10_AcceptDecisionOnPackingList(self):
"""
- Increase or Decrease the quantity of a Packing List line
- Accept Decision on Packing List
- Packing List must not be divergent and use new quantity
- Invoice must not be divergent and use new quantity
"""
if not quiet:
self.logMessage('InvoiceAcceptDecisionOnPackingList')
end_sequence = \
"""
stepSetContainerFullQuantity
......@@ -2971,9 +2945,9 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
sequence = self.PACKING_LIST_DEFAULT_SEQUENCE + \
seq + end_sequence
sequence_list.addSequenceString(sequence)
sequence_list.play(self, quiet=quiet)
sequence_list.play(self)
def test_16a_ManuallyAddedMovementsManyTransactions(self, quiet=quiet):
def test_16a_ManuallyAddedMovementsManyTransactions(self):
"""
Checks that adding invoice lines and accounting lines to one invoice
generates correct simulation
......@@ -2981,8 +2955,6 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
In this case checks what is happening, where movements are added in
one transaction and edited in another
"""
if not quiet:
self.logMessage('Invoice with Manually Added Movements in separate transactions')
sequence_list = SequenceList()
for base_sequence in (self.PACKING_LIST_DEFAULT_SEQUENCE, ) :
sequence_list.addSequenceString(
......@@ -3005,10 +2977,10 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
stepTic
stepCheckSimulationTrees
""")
sequence_list.play(self, quiet=quiet)
sequence_list.play(self)
def test_11_AcceptDecisionOnPackingListAndInvoice(self, quiet=quiet):
def test_11_AcceptDecisionOnPackingListAndInvoice(self):
"""
- Increase or Decrease the quantity of a Packing List line
- Accept Decision on Packing List
......@@ -3018,8 +2990,6 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
- Packing List must not be divergent and use new quantity
- Invoice must not be divergent and use old quantity
"""
if not quiet:
self.logMessage('InvoiceAcceptDecisionOnPackingListAndInvoice')
mid_sequence = \
"""
stepSetContainerFullQuantity
......@@ -3092,9 +3062,9 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
sequence = self.PACKING_LIST_DEFAULT_SEQUENCE + \
seq1 + mid_sequence + seq2 + end_sequence
sequence_list.addSequenceString(sequence)
sequence_list.play(self, quiet=quiet)
sequence_list.play(self)
def test_12_SplitPackingListAndAcceptInvoice(self, quiet=quiet):
def test_12_SplitPackingListAndAcceptInvoice(self):
"""
- Decrease the quantity of a Packing List line
- Split and Defer on Packing List
......@@ -3114,8 +3084,6 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
- Invoice1 must not be divergent and use old quantity
- Invoice2 must not be divergent and use 0 as quantity
"""
if not quiet:
self.logMessage('InvoiceSplitPackingListAndAcceptInvoice')
sequence = self.PACKING_LIST_DEFAULT_SEQUENCE + \
"""
stepCheckInvoicingRule
......@@ -3208,9 +3176,9 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
stepRebuildAndCheckNothingIsCreated
stepCheckInvoicesConsistency
"""
self.playSequence(sequence, quiet=quiet)
self.playSequence(sequence)
def test_13_SplitAndDeferInvoice(self, quiet=quiet):
def test_13_SplitAndDeferInvoice(self):
"""
- Accept Order, Accept Packing List
- Decrease quantity on Invoice
......@@ -3221,8 +3189,6 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
- Invoice must not be divergent and use new quantity
- splitted Invoice must not be divergent and use old - new quantity
"""
if not quiet:
self.logMessage('InvoiceSplitAndDeferInvoice')
sequence = self.PACKING_LIST_DEFAULT_SEQUENCE + \
"""
stepSetReadyPackingList
......@@ -3279,9 +3245,9 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
stepRebuildAndCheckNothingIsCreated
stepCheckInvoicesConsistency
"""
self.playSequence(sequence, quiet=quiet)
self.playSequence(sequence)
def test_14_AcceptDecisionOnInvoice(self, quiet=quiet):
def test_14_AcceptDecisionOnInvoice(self):
"""
- Accept Order, Accept Packing List
- Increase or Decrease quantity on Invoice
......@@ -3290,8 +3256,6 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
- Packing List must not be divergent and use old quantity
- Invoice must not be divergent and use new quantity
"""
if not quiet:
self.logMessage('InvoiceAcceptDecisionOnInvoice')
mid_sequence = \
"""
stepSetReadyPackingList
......@@ -3348,7 +3312,7 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
sequence = self.PACKING_LIST_DEFAULT_SEQUENCE + \
mid_sequence + seq + end_sequence
sequence_list.addSequenceString(sequence)
sequence_list.play(self, quiet=quiet)
sequence_list.play(self)
def test_Reference(self):
......@@ -3372,13 +3336,11 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
self.assertEquals('1', invoice.getReference())
def test_16_ManuallyAddedMovements(self, quiet=quiet):
def test_16_ManuallyAddedMovements(self):
"""
Checks that adding invoice lines and accounting lines to one invoice
generates correct simulation
"""
if not quiet:
self.logMessage('Invoice with Manually Added Movements')
sequence_list = SequenceList()
for base_sequence in (self.PACKING_LIST_DEFAULT_SEQUENCE, ) :
sequence_list.addSequenceString(
......@@ -3400,15 +3362,13 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
stepTic
stepCheckSimulationTrees
""")
sequence_list.play(self, quiet=quiet)
sequence_list.play(self)
def test_17_ManuallyAddedWrongMovements(self, quiet=quiet):
def test_17_ManuallyAddedWrongMovements(self):
"""
Checks that adding invoice lines and accounting lines to one invoice
generates correct simulation, even when adding very wrong movements
"""
if not quiet:
self.logMessage('Invoice with Manually Added Movements')
sequence_list = SequenceList()
for base_sequence in (self.PACKING_LIST_DEFAULT_SEQUENCE, ) :
sequence_list.addSequenceString(
......@@ -3428,14 +3388,12 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
stepCheckStartInvoiceFail
stepCheckSimulationTrees
""")
sequence_list.play(self, quiet=quiet)
sequence_list.play(self)
def test_18_compareInvoiceAndPackingList(self, quiet=quiet):
def test_18_compareInvoiceAndPackingList(self):
"""
Checks that a Simple Invoice is created from a Packing List
"""
if not quiet:
self.logMessage('Simple Invoice')
sequence_list = SequenceList()
for base_sequence in (self.PACKING_LIST_DEFAULT_SEQUENCE, ) :
sequence_list.addSequenceString(
......@@ -3452,7 +3410,7 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
stepCheckInvoicesConsistency
stepCheckPackingListInvoice
""")
sequence_list.play(self, quiet=quiet)
sequence_list.play(self)
def _adoptDivergenceOnPackingList(self, packing_list, divergence_list):
builder_list = packing_list.getBuilderList()
......@@ -3460,13 +3418,12 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
builder.solveDivergence(packing_list.getRelativeUrl(),
divergence_to_adopt_list=divergence_list)
def test_accept_quantity_divergence_on_invoice_with_started_packing_list(
self, quiet=quiet):
def test_accept_quantity_divergence_on_invoice_with_started_packing_list(self):
# only applies to sale invoice, because purchase invoices are not built yet
# when the packing list is in started state
sequence_list = SequenceList()
sequence = sequence_list.addSequenceString(self.PACKING_LIST_DEFAULT_SEQUENCE)
sequence_list.play(self, quiet=quiet)
sequence_list.play(self)
packing_list = sequence.get('packing_list')
packing_list_line = packing_list.getMovementList()[0]
......
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