[Erp5-report] r34386 herve.poulain - /erp5/trunk/products/ERP5/tests/testAccounting.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Apr 8 15:23:57 CEST 2010


Author: herve.poulain
Date: Thu Apr  8 15:23:55 2010
New Revision: 34386

URL: http://svn.erp5.org?rev=34386&view=rev
Log:
Add the unit test to check that the price currency used in bank account and
transaction must to be the same.

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=34386&r1=34385&r2=34386&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testAccounting.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testAccounting.py [utf8] Thu Apr  8 15:23:55 2010
@@ -517,6 +517,32 @@
     # with bank account, it's OK
     bank_account = self.section.newContent(portal_type='Bank Account')
     accounting_transaction.setSourcePaymentValue(bank_account)
+    self.portal.portal_workflow.doActionFor(accounting_transaction, 'stop_action')
+
+  def test_PaymentTransactionValidationCheckBankAccountPriceCurrency(self):
+    # we have to declare a transaction with price_currency different from the
+    # bank account
+    bank_account = self.section.newContent(portal_type='Bank Account',
+        price_currency_value=self.currency_module.euro)
+    accounting_transaction = self._makeOne(
+               portal_type='Payment Transaction',
+               start_date=DateTime('2007/01/02'),
+               destination_section_value=self.person_module.john_smith,
+               payment_mode='default',
+               resource_value=self.currency_module.usd,
+               source_payment_value=bank_account,
+               lines=(dict(source_value=self.account_module.bank,
+                           destination_value=self.account_module.bank,
+                           source_debit=500),
+                      dict(source_value=self.account_module.receivable,
+                           destination_value=self.account_module.receivable,
+                           source_credit=500)))
+    # refused because bank account currency different from transaction resource
+    self.assertRaises(ValidationFailed,
+        self.portal.portal_workflow.doActionFor,
+        accounting_transaction, 'stop_action')
+    # with same currency in bank account and transaction, it's OK
+    accounting_transaction.setResourceValue(self.currency_module.euro)
     self.portal.portal_workflow.doActionFor(accounting_transaction, 'stop_action')
 
   def test_NonBalancedAccountingTransaction(self):




More information about the Erp5-report mailing list