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

use bypass_init_script when creating Invoice to make sure that a script...

use bypass_init_script when creating Invoice to make sure that a script attached to the portal type will not create lines.
added a few checks


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4059 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d7de4015
...@@ -38,6 +38,7 @@ way it is used in the invoice related simulation. ...@@ -38,6 +38,7 @@ way it is used in the invoice related simulation.
# * test payment rule & payment builder # * test payment rule & payment builder
# * test simulation purge when Payment delivered or top level Order cancelled # * test simulation purge when Payment delivered or top level Order cancelled
# * test invoicing rule by connecting to order test. # * test invoicing rule by connecting to order test.
# * test removing cells for a line
# #
import os, sys, random import os, sys, random
...@@ -117,6 +118,10 @@ class TestAccountingRules(ERP5TypeTestCase): ...@@ -117,6 +118,10 @@ class TestAccountingRules(ERP5TypeTestCase):
def afterSetUp(self) : def afterSetUp(self) :
self.login() self.login()
self.createCategories() self.createCategories()
# FIXME : this is a workaround for a bug in business template
# installation : path elements are not reindexed
# ... so we reindex manually here
self.getPortal().portal_rules.recursiveImmediateReindexObject()
def login(self): def login(self):
uf = self.getPortal().acl_users uf = self.getPortal().acl_users
...@@ -528,6 +533,7 @@ class TestAccountingRules(ERP5TypeTestCase): ...@@ -528,6 +533,7 @@ class TestAccountingRules(ERP5TypeTestCase):
start_date = DateTime(2004, 01, 01), start_date = DateTime(2004, 01, 01),
source_section = vendor.getRelativeUrl(), source_section = vendor.getRelativeUrl(),
destination_section = client.getRelativeUrl(), destination_section = client.getRelativeUrl(),
bypass_init_script = 1,
) )
sequence.edit( sequence.edit(
...@@ -555,6 +561,7 @@ class TestAccountingRules(ERP5TypeTestCase): ...@@ -555,6 +561,7 @@ class TestAccountingRules(ERP5TypeTestCase):
start_date = DateTime(2004, 01, 01), start_date = DateTime(2004, 01, 01),
source_section = vendor.getRelativeUrl(), source_section = vendor.getRelativeUrl(),
destination_section = client.getRelativeUrl(), destination_section = client.getRelativeUrl(),
bypass_init_script = 1,
) )
invoice_line = simple_invoice.newContent( invoice_line = simple_invoice.newContent(
...@@ -590,6 +597,7 @@ class TestAccountingRules(ERP5TypeTestCase): ...@@ -590,6 +597,7 @@ class TestAccountingRules(ERP5TypeTestCase):
start_date = DateTime(2004, 01, 01), start_date = DateTime(2004, 01, 01),
source_section = vendor.getRelativeUrl(), source_section = vendor.getRelativeUrl(),
destination_section = client.getRelativeUrl(), destination_section = client.getRelativeUrl(),
bypass_init_script = 1,
) )
invoice_line = simple_invoice.newContent( invoice_line = simple_invoice.newContent(
...@@ -653,7 +661,7 @@ class TestAccountingRules(ERP5TypeTestCase): ...@@ -653,7 +661,7 @@ class TestAccountingRules(ERP5TypeTestCase):
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."""
# edit is done through interaction workflow, so we just call 'edit' # edit is done through interaction workflow, so we just call 'edit'
# on the invoice # on the invoice (but this is not necessary)
invoice=sequence.get('invoice') invoice=sequence.get('invoice')
invoice.edit() invoice.edit()
...@@ -676,6 +684,7 @@ class TestAccountingRules(ERP5TypeTestCase): ...@@ -676,6 +684,7 @@ class TestAccountingRules(ERP5TypeTestCase):
start_date = DateTime(2004, 01, 01), start_date = DateTime(2004, 01, 01),
source_section = vendor.getRelativeUrl(), source_section = vendor.getRelativeUrl(),
destination_section = client.getRelativeUrl(), destination_section = client.getRelativeUrl(),
bypass_init_script = 1,
) )
invoice_line1 = simple_invoice.newContent( invoice_line1 = simple_invoice.newContent(
...@@ -718,6 +727,7 @@ class TestAccountingRules(ERP5TypeTestCase): ...@@ -718,6 +727,7 @@ class TestAccountingRules(ERP5TypeTestCase):
start_date = DateTime(2004, 01, 01), start_date = DateTime(2004, 01, 01),
source_section = vendor.getRelativeUrl(), source_section = vendor.getRelativeUrl(),
destination_section = client.getRelativeUrl(), destination_section = client.getRelativeUrl(),
bypass_init_script = 1,
) )
invoice_line = simple_invoice.newContent( invoice_line = simple_invoice.newContent(
...@@ -792,6 +802,7 @@ class TestAccountingRules(ERP5TypeTestCase): ...@@ -792,6 +802,7 @@ class TestAccountingRules(ERP5TypeTestCase):
start_date = DateTime(2004, 01, 01), start_date = DateTime(2004, 01, 01),
source_section = vendor.getRelativeUrl(), source_section = vendor.getRelativeUrl(),
destination_section = client.getRelativeUrl(), destination_section = client.getRelativeUrl(),
bypass_init_script = 1,
) )
notebook_line = multi_line_invoice.newContent( notebook_line = multi_line_invoice.newContent(
...@@ -1291,6 +1302,9 @@ class TestAccountingRules(ERP5TypeTestCase): ...@@ -1291,6 +1302,9 @@ class TestAccountingRules(ERP5TypeTestCase):
invoice_transaction_line.getSourceId()] invoice_transaction_line.getSourceId()]
self.assertEquals(debit, invoice_transaction_line.getSourceDebit()) self.assertEquals(debit, invoice_transaction_line.getSourceDebit())
self.assertEquals(credit, invoice_transaction_line.getSourceCredit()) self.assertEquals(credit, invoice_transaction_line.getSourceCredit())
self.assertNotEquals(
len(invoice_transaction_line.getDeliveryRelatedValueList(
portal_type='Simulation Movement')), 0)
def stepCheckAccountingLinesCreatedForMultiLineInvoice( def stepCheckAccountingLinesCreatedForMultiLineInvoice(
self, sequence, **kw) : self, sequence, **kw) :
...@@ -1330,7 +1344,9 @@ class TestAccountingRules(ERP5TypeTestCase): ...@@ -1330,7 +1344,9 @@ class TestAccountingRules(ERP5TypeTestCase):
invoice_transaction_line.getSourceId()] invoice_transaction_line.getSourceId()]
self.assertEquals(debit, invoice_transaction_line.getSourceDebit()) self.assertEquals(debit, invoice_transaction_line.getSourceDebit())
self.assertEquals(credit, invoice_transaction_line.getSourceCredit()) self.assertEquals(credit, invoice_transaction_line.getSourceCredit())
self.assertNotEquals(
len(invoice_transaction_line.getDeliveryRelatedValueList(
portal_type='Simulation Movement')), 0)
def stepRebuildAndCheckNothingIsCreated(self, sequence, **kw) : def stepRebuildAndCheckNothingIsCreated(self, sequence, **kw) :
""" Calls the DeliveryBuilder again and checks that the accounting module """ Calls the DeliveryBuilder again and checks that the accounting module
......
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