[Erp5-report] r17697 - /erp5/trunk/products/ERP5/tests/testAccounting.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Nov 20 11:53:11 CET 2007


Author: jerome
Date: Tue Nov 20 11:53:11 2007
New Revision: 17697

URL: http://svn.erp5.org?rev=17697&view=rev
Log:
tests that accounting period dates are not taken into account if there are no
accounts used in accounting line on this side.


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

Modified: erp5/trunk/products/ERP5/tests/testAccounting.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testAccounting.py?rev=17697&r1=17696&r2=17697&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testAccounting.py (original)
+++ erp5/trunk/products/ERP5/tests/testAccounting.py Tue Nov 20 11:53:11 2007
@@ -317,6 +317,32 @@
         transaction, 'stop_action')
     # in 2007, it's OK
     transaction.setStopDate(DateTime("2007/03/03"))
+    self.portal.portal_workflow.doActionFor(transaction, 'stop_action')
+
+  def test_UnusedSectionTransactionValidationDate(self):
+    # If a section doesn't have any accounts on its side, we don't check the
+    # accounting period dates
+    transaction = self._makeOne(
+               portal_type='Accounting Transaction',
+               start_date=DateTime('2006/03/03'),
+               source_section_value=self.organisation_module.supplier,
+               destination_section_value=self.section,
+               payment_mode='default',
+               lines=(dict(source_value=self.account_module.goods_purchase,
+                           destination_value=self.account_module.goods_purchase,
+                           source_debit=500),
+                      dict(source_value=self.account_module.receivable,
+                           destination_value=self.account_module.receivable,
+                           source_credit=500)))
+
+    # 2006 is closed for destination_section
+    self.assertRaises(ValidationFailed,
+        self.portal.portal_workflow.doActionFor,
+        transaction, 'stop_action')
+    # If we don't have accounts on destination side, validating transaction is
+    # not refused
+    for line in transaction.getMovementList():
+      line.setDestination(None)
     self.portal.portal_workflow.doActionFor(transaction, 'stop_action')
 
   def test_AccountingTransactionValidationStartDate(self):




More information about the Erp5-report mailing list