From 93a40a0918f42bda34ee294439daca32860c668e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Thu, 20 Mar 2008 13:03:15 +0000 Subject: [PATCH] make sure a reference is automatically generated on sale invoices git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20072 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/tests/testInvoice.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/product/ERP5/tests/testInvoice.py b/product/ERP5/tests/testInvoice.py index 1b2d1735d0..cea91e2f8b 100644 --- a/product/ERP5/tests/testInvoice.py +++ b/product/ERP5/tests/testInvoice.py @@ -37,6 +37,7 @@ TODO: 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 @@ class TestInvoice(TestPackingListMixin, 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. -- 2.30.9