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

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Jul 6 12:57:29 CEST 2010


Author: luke
Date: Tue Jul  6 12:57:28 2010
New Revision: 36887

URL: http://svn.erp5.org?rev=36887&view=rev
Log:
 - check behaviour of Invoice_getRemainingTotalPayablePrice in case if Payment Transaction is deleted
 - clean up site in tear down using user with Manager role to avoid issues with unaccessible objects

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=36887&r1=36886&r2=36887&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testAccounting.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testAccounting.py [utf8] Tue Jul  6 12:57:28 2010
@@ -206,6 +206,7 @@ class AccountingTestCase(ERP5TypeTestCas
     """
     if os.environ.get('erp5_save_data_fs'):
       return
+    self.login('ERP5TypeTestCase')
     transaction.abort()
     self.accounting_module.manage_delObjects(
                       list(self.accounting_module.objectIds()))
@@ -2594,6 +2595,31 @@ class TestTransactions(AccountingTestCas
         self.assertEquals(100, line.getSourceCredit())
         self.assertEquals(None, line.getSourceTotalAssetPrice())
       
+  # tests for Invoice_getRemainingTotalPayablePrice
+  def test_Invoice_getRemainingTotalPayablePriceDeletedPayment(self):
+    """Checks in case of deleted Payments related to invoice"""
+    # Simple case of creating a related payment transaction.
+    payment_node = self.section.newContent(portal_type='Bank Account')
+    invoice = self._makeOne(
+               destination_section_value=self.organisation_module.client_1,
+               lines=(dict(source_value=self.account_module.goods_purchase,
+                           source_debit=100),
+                      dict(source_value=self.account_module.receivable,
+                           source_credit=100)))
+    payment = invoice.Invoice_createRelatedPaymentTransaction(
+                                  node=self.account_module.bank.getRelativeUrl(),
+                                  payment=payment_node.getRelativeUrl(),
+                                  payment_mode='check',
+                                  batch_mode=1)
+    transaction.commit()
+    self.tic()
+    remaining_price = invoice.Invoice_getRemainingTotalPayablePrice()
+    self.assertEqual(-100, remaining_price)
+    payment.delete()
+    transaction.commit()
+    self.tic()
+    remaining_price = invoice.Invoice_getRemainingTotalPayablePrice()
+    self.assertEqual(-100, remaining_price)
 
   # tests for Grouping References
   def test_GroupingReferenceResetedOnCopyPaste(self):




More information about the Erp5-report mailing list