[Erp5-report] r20072 - /erp5/trunk/products/ERP5/tests/testInvoice.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Mar 20 14:03:15 CET 2008


Author: jerome
Date: Thu Mar 20 14:03:15 2008
New Revision: 20072

URL: http://svn.erp5.org?rev=20072&view=rev
Log:
make sure a reference is automatically generated on sale invoices

Modified:
    erp5/trunk/products/ERP5/tests/testInvoice.py

Modified: erp5/trunk/products/ERP5/tests/testInvoice.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testInvoice.py?rev=20072&r1=20071&r2=20072&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testInvoice.py (original)
+++ erp5/trunk/products/ERP5/tests/testInvoice.py Thu Mar 20 14:03:15 2008
@@ -37,6 +37,7 @@
 
 from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
 from AccessControl.SecurityManagement import newSecurityManager
+from DateTime import DateTime
 from Acquisition import aq_parent
 from zLOG import LOG
 from Products.ERP5Type.tests.Sequence import SequenceList
@@ -1846,6 +1847,30 @@
       sequence_list.addSequenceString(sequence)
     sequence_list.play(self, quiet=quiet)
 
+
+  def test_Reference(self):
+    # A reference is set automatically on Sale Invoice Transaction
+    supplier = self.portal.organisation_module.newContent(
+                            portal_type='Organisation',
+                            title='Supplier')
+    client = self.portal.organisation_module.newContent(
+                            portal_type='Organisation',
+                            title='Client')
+    currency = self.portal.currency_module.newContent(
+                            portal_type='Currency')
+    invoice = self.portal.accounting_module.newContent(
+                    portal_type='Sale Invoice Transaction',
+                    start_date=DateTime(),
+                    price_currency_value=currency,
+                    resource_value=currency,
+                    source_section_value=supplier,
+                    destination_section_value=client)
+    self.portal.portal_workflow.doActionFor(invoice, 'confirm_action')
+
+    # We could generate a better reference here.
+    self.assertEquals('1', invoice.getReference())
+    
+
   def test_15_CopyAndPaste(self, run=RUN_ALL_TESTS):
     """Test copy on paste on Invoice.
     When an invoice is copy/pasted, references should be resetted.




More information about the Erp5-report mailing list