Commit ba9f9615 authored by Jérome Perrin's avatar Jérome Perrin

update test, invoices are generated in confirmed state, and accounting is

generated when passing the "start" transition.

fix the latest test, the invoice transaction movement has no price currency in
the simulation, only the invoice movement



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20592 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ba85bd28
...@@ -277,26 +277,6 @@ class TestInvoice(TestPackingListMixin, ...@@ -277,26 +277,6 @@ class TestInvoice(TestPackingListMixin,
invoice.portal_workflow.doActionFor(invoice, invoice.portal_workflow.doActionFor(invoice,
transition_name, wf_id='accounting_workflow') transition_name, wf_id='accounting_workflow')
def stepConfirmInvoice(self, sequence=None, sequence_list=None, **kw):
""" set the Packing List as Ready. This must build the invoice. """
self.modifyInvoiceState('confirm_action', sequence=sequence)
invoice = sequence.get('invoice')
self.assertEquals(invoice.getSimulationState(), 'confirmed')
def stepSetReadyInvoice(self, sequence=None, sequence_list=None, **kw):
""" set the Packing List as Ready. This must build the invoice. """
self.modifyInvoiceState('set_ready_action', sequence=sequence)
invoice = sequence.get('invoice')
self.assertEquals(invoice.getSimulationState(), 'ready')
def stepSetReadyNewInvoice(self, sequence=None,
sequence_list=None, **kw):
""" set the Packing List as Ready. This must build the invoice. """
invoice = sequence.get('new_invoice')
self.modifyInvoiceState('set_ready_action', sequence=sequence,
invoice=invoice)
self.assertEquals(invoice.getSimulationState(), 'ready')
def stepStartInvoice(self, sequence=None, sequence_list=None, **kw): def stepStartInvoice(self, sequence=None, sequence_list=None, **kw):
self.modifyInvoiceState('start_action', sequence=sequence) self.modifyInvoiceState('start_action', sequence=sequence)
invoice = sequence.get('invoice') invoice = sequence.get('invoice')
...@@ -373,8 +353,8 @@ class TestInvoice(TestPackingListMixin, ...@@ -373,8 +353,8 @@ class TestInvoice(TestPackingListMixin,
invoice = related_invoice_list[0].getObject() invoice = related_invoice_list[0].getObject()
self.failUnless(invoice is not None) self.failUnless(invoice is not None)
# Invoices created by Delivery Builder are in planned state # Invoices created by Delivery Builder are in confirmed state
self.assertEquals(invoice.getSimulationState(), 'planned') self.assertEquals(invoice.getSimulationState(), 'confirmed')
# Get the list of simulation movements of packing list ... # Get the list of simulation movements of packing list ...
packing_list_simulation_movement_list = [] packing_list_simulation_movement_list = []
...@@ -622,29 +602,31 @@ class TestInvoice(TestPackingListMixin, ...@@ -622,29 +602,31 @@ class TestInvoice(TestPackingListMixin,
def stepCheckTwoInvoices(self,sequence=None, sequence_list=None, **kw): def stepCheckTwoInvoices(self,sequence=None, sequence_list=None, **kw):
""" checks invoice properties are well set. """ """ checks invoice properties are well set. """
# New we will check that we have two invoices # Now we will check that we have two invoices created
packing_list = sequence.get('packing_list') packing_list = sequence.get('packing_list')
invoice_list = packing_list.getCausalityRelatedValueList( invoice_list = packing_list.getCausalityRelatedValueList(
portal_type=self.sale_invoice_transaction_portal_type) portal_type=self.sale_invoice_transaction_portal_type)
self.assertEquals(len(invoice_list),1) self.assertEquals(len(invoice_list),1)
invoice = invoice_list[0] invoice = invoice_list[0]
self.assertEquals(invoice.getSimulationState(), 'confirmed')
sequence.edit(invoice=invoice) sequence.edit(invoice=invoice)
new_packing_list = sequence.get('new_packing_list') new_packing_list = sequence.get('new_packing_list')
new_invoice_list = new_packing_list.getCausalityRelatedValueList( new_invoice_list = new_packing_list.getCausalityRelatedValueList(
portal_type=self.sale_invoice_transaction_portal_type) portal_type=self.sale_invoice_transaction_portal_type)
self.assertEquals(len(new_invoice_list),1) self.assertEquals(len(new_invoice_list),1)
new_invoice = new_invoice_list[0] new_invoice = new_invoice_list[0]
self.assertEquals(new_invoice.getSimulationState(), 'confirmed')
sequence.edit(new_invoice=new_invoice) sequence.edit(new_invoice=new_invoice)
def stepConfirmTwoInvoices(self,sequence=None, sequence_list=None, **kw): def stepStartTwoInvoices(self,sequence=None, sequence_list=None, **kw):
""" confirm both invoices. """ """ start both invoices. """
portal = self.getPortal() portal = self.getPortal()
invoice = sequence.get('invoice') invoice = sequence.get('invoice')
new_invoice = sequence.get('new_invoice') new_invoice = sequence.get('new_invoice')
portal.portal_workflow.doActionFor(invoice, portal.portal_workflow.doActionFor(invoice,
'confirm_action',wf_id='accounting_workflow') 'start_action',wf_id='accounting_workflow')
portal.portal_workflow.doActionFor(new_invoice, portal.portal_workflow.doActionFor(new_invoice,
'confirm_action',wf_id='accounting_workflow') 'start_action',wf_id='accounting_workflow')
def stepCheckTwoInvoicesTransactionLines(self,sequence=None, def stepCheckTwoInvoicesTransactionLines(self,sequence=None,
sequence_list=None, **kw): sequence_list=None, **kw):
...@@ -940,9 +922,9 @@ class TestInvoice(TestPackingListMixin, ...@@ -940,9 +922,9 @@ class TestInvoice(TestPackingListMixin,
for movement in invoice.getMovementList(): for movement in invoice.getMovementList():
movement.edit(resource_value=sequence.get('resource')) movement.edit(resource_value=sequence.get('resource'))
def stepCheckConfirmInvoiceFails(self, sequence=None, sequence_list=[]): def stepCheckStartInvoiceFail(self, sequence=None, sequence_list=[]):
""" """
checks that it's not possible to confirm an invoice with really wrong checks that it's not possible to start an invoice with really wrong
lines lines
""" """
try: try:
...@@ -961,7 +943,7 @@ class TestInvoice(TestPackingListMixin, ...@@ -961,7 +943,7 @@ class TestInvoice(TestPackingListMixin,
activity_tool = self.getActivityTool() activity_tool = self.getActivityTool()
activity_tool.manageClearActivities(keep=0) activity_tool.manageClearActivities(keep=0)
else: else:
self.fail("Error: stepConfirmInvoice didn't fail, the builder script" self.fail("Error: stepStartInvoice didn't fail, the builder script"
+ " InvoiceTransaction_postTransactionLineGeneration should have" + " InvoiceTransaction_postTransactionLineGeneration should have"
+ " complained that accounting movements use multiple resources") + " complained that accounting movements use multiple resources")
...@@ -1193,7 +1175,7 @@ class TestInvoice(TestPackingListMixin, ...@@ -1193,7 +1175,7 @@ class TestInvoice(TestPackingListMixin,
stepTic stepTic
stepCheckTwoInvoices stepCheckTwoInvoices
stepRemoveDateMovementGroupForTransactionBuilder stepRemoveDateMovementGroupForTransactionBuilder
stepConfirmTwoInvoices stepStartTwoInvoices
stepTic stepTic
stepCheckTwoInvoicesTransactionLines stepCheckTwoInvoicesTransactionLines
stepCheckInvoicesConsistency stepCheckInvoicesConsistency
...@@ -1482,7 +1464,7 @@ class TestInvoice(TestPackingListMixin, ...@@ -1482,7 +1464,7 @@ class TestInvoice(TestPackingListMixin,
stepCheckPackingListIsSolved stepCheckPackingListIsSolved
stepCheckInvoiceTransactionRule stepCheckInvoiceTransactionRule
stepConfirmInvoice stepStartInvoice
stepTic stepTic
stepStopInvoice stepStopInvoice
stepTic stepTic
...@@ -1555,7 +1537,7 @@ class TestInvoice(TestPackingListMixin, ...@@ -1555,7 +1537,7 @@ class TestInvoice(TestPackingListMixin,
stepCheckInvoiceIsDiverged stepCheckInvoiceIsDiverged
stepAcceptDecisionInvoice stepAcceptDecisionInvoice
stepTic stepTic
stepConfirmInvoice stepStartInvoice
stepTic stepTic
stepStopInvoice stepStopInvoice
stepTic stepTic
...@@ -1646,7 +1628,7 @@ class TestInvoice(TestPackingListMixin, ...@@ -1646,7 +1628,7 @@ class TestInvoice(TestPackingListMixin,
stepCheckInvoiceIsCalculating stepCheckInvoiceIsCalculating
stepAcceptDecisionInvoice stepAcceptDecisionInvoice
stepTic stepTic
stepConfirmInvoice stepStartInvoice
stepTic stepTic
stepStopInvoice stepStopInvoice
stepTic stepTic
...@@ -1684,7 +1666,7 @@ class TestInvoice(TestPackingListMixin, ...@@ -1684,7 +1666,7 @@ class TestInvoice(TestPackingListMixin,
stepCheckInvoiceIsCalculating stepCheckInvoiceIsCalculating
stepAcceptDecisionInvoice stepAcceptDecisionInvoice
stepTic stepTic
stepConfirmInvoice stepStartInvoice
stepTic stepTic
stepStopInvoice stepStopInvoice
stepTic stepTic
...@@ -1737,7 +1719,7 @@ class TestInvoice(TestPackingListMixin, ...@@ -1737,7 +1719,7 @@ class TestInvoice(TestPackingListMixin,
stepCheckInvoiceIsCalculating stepCheckInvoiceIsCalculating
stepSplitAndDeferInvoice stepSplitAndDeferInvoice
stepTic stepTic
stepConfirmInvoice stepStartInvoice
stepTic stepTic
stepStopInvoice stepStopInvoice
stepTic stepTic
...@@ -1756,7 +1738,7 @@ class TestInvoice(TestPackingListMixin, ...@@ -1756,7 +1738,7 @@ class TestInvoice(TestPackingListMixin,
stepSwitchInvoices stepSwitchInvoices
stepConfirmInvoice stepStartInvoice
stepTic stepTic
stepStopInvoice stepStopInvoice
stepTic stepTic
...@@ -1804,7 +1786,7 @@ class TestInvoice(TestPackingListMixin, ...@@ -1804,7 +1786,7 @@ class TestInvoice(TestPackingListMixin,
stepCheckInvoiceIsCalculating stepCheckInvoiceIsCalculating
stepAcceptDecisionInvoice stepAcceptDecisionInvoice
stepTic stepTic
stepConfirmInvoice stepStartInvoice
stepTic stepTic
stepStopInvoice stepStopInvoice
stepTic stepTic
...@@ -1905,7 +1887,7 @@ class TestInvoice(TestPackingListMixin, ...@@ -1905,7 +1887,7 @@ class TestInvoice(TestPackingListMixin,
stepCheckInvoicesConsistency stepCheckInvoicesConsistency
stepAddInvoiceLines stepAddInvoiceLines
stepTic stepTic
stepConfirmInvoice stepStartInvoice
stepTic stepTic
stepCheckSimulationTrees stepCheckSimulationTrees
""") """)
...@@ -1932,8 +1914,8 @@ class TestInvoice(TestPackingListMixin, ...@@ -1932,8 +1914,8 @@ class TestInvoice(TestPackingListMixin,
stepCheckInvoiceBuilding stepCheckInvoiceBuilding
stepAddWrongInvoiceLines stepAddWrongInvoiceLines
stepTic stepTic
stepConfirmInvoice stepStartInvoice
stepCheckConfirmInvoiceFails stepCheckStartInvoiceFail
stepCheckSimulationTrees stepCheckSimulationTrees
""") """)
sequence_list.play(self, quiet=quiet) sequence_list.play(self, quiet=quiet)
...@@ -1973,7 +1955,7 @@ class TestInvoice(TestPackingListMixin, ...@@ -1973,7 +1955,7 @@ class TestInvoice(TestPackingListMixin,
self.assertEquals(order_price_currency, self.assertEquals(order_price_currency,
invoice_transaction_movement.getResource()) invoice_transaction_movement.getResource())
self.assertEquals(order_price_currency, self.assertEquals(order_price_currency,
invoice_transaction_movement.getPriceCurrency()) delivery_movement.getPriceCurrency())
#class TestPurchaseInvoice(TestInvoice): #class TestPurchaseInvoice(TestInvoice):
# order_portal_type = 'Purchase Order' # order_portal_type = 'Purchase Order'
......
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