Commit 6f1527f2 authored by Jérome Perrin's avatar Jérome Perrin

tests for invoice editing between expand and build steps are now working.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3872 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 67814545
...@@ -88,7 +88,7 @@ class TestAccountingRules(ERP5TypeTestCase): ...@@ -88,7 +88,7 @@ class TestAccountingRules(ERP5TypeTestCase):
payment_transaction_portal_type = "Payment Transaction" payment_transaction_portal_type = "Payment Transaction"
def getTitle(self): def getTitle(self):
return "Test Accounting Rules" return "Accounting Rules"
def getBusinessTemplateList(self): def getBusinessTemplateList(self):
""" Return the list of business templates. """ """ Return the list of business templates. """
...@@ -643,14 +643,17 @@ class TestAccountingRules(ERP5TypeTestCase): ...@@ -643,14 +643,17 @@ class TestAccountingRules(ERP5TypeTestCase):
""" """
invoice = sequence.get('invoice') invoice = sequence.get('invoice')
invoice_line = sequence.get('invoice_line') invoice_line = sequence.get('invoice_line')
invoice.deleteContent([invoice_line.getId()]) invoice._delObject(invoice_line.getId())
invoice.recursiveReindexObject()
def stepUpdateAppliedRule(self, sequence, **kw) : def stepUpdateAppliedRule(self, sequence, **kw) :
""" update the applied rule for the invoice. In the UI, the call to """ update the applied rule for the invoice. In the UI, the call to
updateAppliedRule is made in an interraction workflow when you edit updateAppliedRule is made in an interraction workflow when you edit
an invoice or its content.""" an invoice or its content."""
sequence.get('invoice').updateAppliedRule( # edit is done through interaction workflow, so we just call 'edit'
rule_id='default_invoice_transaction_rule') # on the invoice
invoice=sequence.get('invoice')
invoice.edit()
def stepCreateSimpleSaleInvoiceTwoLines(self, sequence, **kw) : def stepCreateSimpleSaleInvoiceTwoLines(self, sequence, **kw) :
""" """
...@@ -1119,7 +1122,7 @@ class TestAccountingRules(ERP5TypeTestCase): ...@@ -1119,7 +1122,7 @@ class TestAccountingRules(ERP5TypeTestCase):
invoice_simulation_movement.objectValues() : invoice_simulation_movement.objectValues() :
for simulation_movement in \ for simulation_movement in \
invoice_transaction_applied_rule.objectValues() : invoice_transaction_applied_rule.objectValues() :
path= simulation_movement.getPath() path = simulation_movement.getPath()
simulation_movement_list.append(simulation_movement) simulation_movement_list.append(simulation_movement)
simulation_movement_quantities[path] = \ simulation_movement_quantities[path] = \
simulation_movement.getQuantity() simulation_movement.getQuantity()
...@@ -1153,7 +1156,7 @@ class TestAccountingRules(ERP5TypeTestCase): ...@@ -1153,7 +1156,7 @@ class TestAccountingRules(ERP5TypeTestCase):
'simulation_movement_section_paths') 'simulation_movement_section_paths')
for simulation_movement in simulation_movement_list : for simulation_movement in simulation_movement_list :
path=simulation_movement.getPath() path = simulation_movement.getPath()
self.assertEquals( self.assertEquals(
simulation_movement.getQuantity(), simulation_movement.getQuantity(),
simulation_movement_quantities[path] simulation_movement_quantities[path]
...@@ -1269,6 +1272,9 @@ class TestAccountingRules(ERP5TypeTestCase): ...@@ -1269,6 +1272,9 @@ class TestAccountingRules(ERP5TypeTestCase):
} }
for invoice_transaction_line in invoice_transaction_line_list : for invoice_transaction_line in invoice_transaction_line_list :
self.assert_(
invoice_transaction_line.getSourceId() in accounting_lines_layout.keys(),
'unexepected source_id %s' % invoice_transaction_line.getSourceId())
debit, credit = accounting_lines_layout[ debit, credit = accounting_lines_layout[
invoice_transaction_line.getSourceId()] invoice_transaction_line.getSourceId()]
self.assertEquals(debit, invoice_transaction_line.getSourceDebit()) self.assertEquals(debit, invoice_transaction_line.getSourceDebit())
...@@ -1547,7 +1553,7 @@ class TestAccountingRules(ERP5TypeTestCase): ...@@ -1547,7 +1553,7 @@ class TestAccountingRules(ERP5TypeTestCase):
# next 5 tests will check update of applied rules. # next 5 tests will check update of applied rules.
def test_05a_SimpleInvoiceReExpandAddLine(self, quiet=0, def test_05a_SimpleInvoiceReExpandAddLine(self, quiet=0,
run=RUN_BROKEN_TESTS): run=RUN_ALL_TESTS):
""" Add a new line then updateAppliedRule. """ Add a new line then updateAppliedRule.
Create an empty invoice, plan, add a line so that this Create an empty invoice, plan, add a line so that this
invoice is the same as `SimpleInvoice`, confirm it then check invoice is the same as `SimpleInvoice`, confirm it then check
...@@ -1575,7 +1581,6 @@ class TestAccountingRules(ERP5TypeTestCase): ...@@ -1575,7 +1581,6 @@ class TestAccountingRules(ERP5TypeTestCase):
stepPlanInvoice stepPlanInvoice
stepTic stepTic
stepAddInvoiceLine stepAddInvoiceLine
stepUpdateAppliedRule
stepConfirmInvoice stepConfirmInvoice
stepTic stepTic
stepCheckAccountingLinesCreatedForSimpleInvoice stepCheckAccountingLinesCreatedForSimpleInvoice
...@@ -1583,7 +1588,7 @@ class TestAccountingRules(ERP5TypeTestCase): ...@@ -1583,7 +1588,7 @@ class TestAccountingRules(ERP5TypeTestCase):
""" ) """ )
def test_05b_SimpleInvoiceReExpandEditLine(self, quiet=0, def test_05b_SimpleInvoiceReExpandEditLine(self, quiet=0,
run = RUN_BROKEN_TESTS): run = RUN_ALL_TESTS):
""" Tests that editing a line updates simulation correctly """ """ Tests that editing a line updates simulation correctly """
if not run: if not run:
return return
...@@ -1606,12 +1611,9 @@ class TestAccountingRules(ERP5TypeTestCase): ...@@ -1606,12 +1611,9 @@ class TestAccountingRules(ERP5TypeTestCase):
stepCreateOtherSimpleSaleInvoice stepCreateOtherSimpleSaleInvoice
stepPlanInvoice stepPlanInvoice
stepTic stepTic
stepCollectSimulationMovements
stepEditInvoiceLine stepEditInvoiceLine
stepUpdateAppliedRule
stepConfirmInvoice stepConfirmInvoice
stepTic stepTic
stepCheckSimulationMovements
stepCheckAccountingLinesCreatedForSimpleInvoice stepCheckAccountingLinesCreatedForSimpleInvoice
stepRebuildAndCheckNothingIsCreated stepRebuildAndCheckNothingIsCreated
""" ) """ )
...@@ -1642,16 +1644,15 @@ class TestAccountingRules(ERP5TypeTestCase): ...@@ -1642,16 +1644,15 @@ class TestAccountingRules(ERP5TypeTestCase):
stepPlanInvoice stepPlanInvoice
stepTic stepTic
stepDeleteInvoiceLine stepDeleteInvoiceLine
stepUpdateAppliedRule
stepTic stepTic
stepConfirmInvoice stepConfirmInvoice
stepTic stepTic
stepCheckAccountingLinesCreatedForSimpleInvoice stepCheckAccountingLinesCreatedForSimpleInvoice
stepRebuildAndCheckNothingIsCreated stepRebuildAndCheckNothingIsCreated
""" ) """ )
def test_05d_SimpleInvoiceReExpandCreateCell(self, quiet=0, def test_05d_SimpleInvoiceReExpandCreateCell(self, quiet=0,
run=RUN_BROKEN_TESTS): run=RUN_ALL_TESTS):
""" Tests that replacing a line by cells updates simulation correctly """ """ Tests that replacing a line by cells updates simulation correctly """
if not run: if not run:
return return
...@@ -1675,14 +1676,12 @@ class TestAccountingRules(ERP5TypeTestCase): ...@@ -1675,14 +1676,12 @@ class TestAccountingRules(ERP5TypeTestCase):
stepPlanInvoice stepPlanInvoice
stepTic stepTic
stepAddCellsInInvoiceLine stepAddCellsInInvoiceLine
stepUpdateAppliedRule
stepTic
stepConfirmInvoice stepConfirmInvoice
stepTic stepTic
stepCheckAccountingLinesCreatedForSimpleInvoice stepCheckAccountingLinesCreatedForSimpleInvoice
stepRebuildAndCheckNothingIsCreated stepRebuildAndCheckNothingIsCreated
""" ) """)
def test_05e_SimpleInvoiceExpandManyTimes( def test_05e_SimpleInvoiceExpandManyTimes(
self, quiet=0, run=RUN_ALL_TESTS): self, quiet=0, run=RUN_ALL_TESTS):
""" Tests that updating an applied rule many times doesn't break the """ Tests that updating an applied rule many times doesn't break the
......
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