[Erp5-report] r23552 - /erp5/trunk/products/ERP5/tests/testERP5CurrencyExchangeLine.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Sep 10 15:52:50 CEST 2008


Author: mame
Date: Wed Sep 10 15:52:49 2008
New Revision: 23552

URL: http://svn.erp5.org?rev=23552&view=rev
Log:
modified DateOfCurrencyExchangeLineNotDateofTransaction so that we see that if the transaction date falls in the validity period date of currency exchange line, conversion is done

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

Modified: erp5/trunk/products/ERP5/tests/testERP5CurrencyExchangeLine.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testERP5CurrencyExchangeLine.py?rev=23552&r1=23551&r2=23552&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testERP5CurrencyExchangeLine.py (original)
+++ erp5/trunk/products/ERP5/tests/testERP5CurrencyExchangeLine.py Wed Sep 10 15:52:49 2008
@@ -293,6 +293,45 @@
     self.tic()#execute transaction
     self.organisation1.edit(price_currency=new_currency.getRelativeUrl())
     euro = self.portal.currency_module.euro
+    accounting_module = self.portal.accounting_module
+    transaction = self._makeOne(
+               portal_type='Purchase Invoice Transaction',
+               stop_date=DateTime('2008/09/08'),
+               source_section_value=self.organisation_module.supplier,
+	       lines=(dict(
+	           destination_value=self.account_module.goods_purchase,
+                           destination_debit=500),
+                      dict(destination_value=self.account_module.receivable,
+                           destination_credit=500)))
+    transaction.AccountingTransaction_convertDestinationPrice(form_id='view')
+    line_list = transaction.contentValues(
+               portal_type=portal.getPortalAccountingMovementTypeList())
+    for line in line_list:
+	self.assertEquals(line.getDestinationTotalAssetPrice(),None)
+	
+  def test_01_DateOfCurrencyExchangeLineNotDateofTransaction(self, quiet=0,
+                                                  run=run_all_test):
+    """
+      Test that the conversion is not done when there is the start date
+      and the end date of a currency exchange line don't correspond to
+      the date of the transaction, but when the date of the transaction
+      falls into the validity period of the currency exchange line,the
+      conversion is done
+    """
+    if not run: return
+    if not quiet:
+       printAndLog('test_01_DateOfCurrencyExchangeLineNotDateofTransaction')
+    portal = self.getPortal()
+    self.organisation_module = self.portal.organisation_module
+    self.organisation1 = self.organisation_module.my_organisation
+    new_currency = portal.currency_module.newContent(portal_type='Currency')
+    new_currency.setReference('XOF')
+    new_currency.setTitle('Francs CFA')
+    new_currency.setBaseUnitQuantity(1.00)
+    get_transaction().commit()
+    self.tic()#execute transaction
+    self.organisation1.edit(price_currency=new_currency.getRelativeUrl())
+    euro = self.portal.currency_module.euro
     x_curr_ex_line = euro.newContent(
 	                          portal_type='Currency Exchange Line',
 				  price_currency=new_currency.getRelativeUrl())
@@ -306,7 +345,7 @@
     x_curr_ex_line.validate()
     self.assertEquals(x_curr_ex_line.getValidationState(),'validated')
     accounting_module = self.portal.accounting_module
-    transaction = self._makeOne(
+    transaction1 = self._makeOne(
                portal_type='Purchase Invoice Transaction',
                stop_date=DateTime('2008/09/08'),
                source_section_value=self.organisation_module.supplier,
@@ -315,48 +354,27 @@
                            destination_debit=500),
                       dict(destination_value=self.account_module.receivable,
                            destination_credit=500)))
-    transaction.AccountingTransaction_convertDestinationPrice(form_id='view')
-    line_list = transaction.contentValues(
+    transaction1.AccountingTransaction_convertDestinationPrice(form_id='view')
+    line_list = transaction1.contentValues(
                portal_type=portal.getPortalAccountingMovementTypeList())
     for line in line_list:
 	self.assertEquals(line.getDestinationTotalAssetPrice(),None)
-	
-  def test_01_DateOfCurrencyExchangeLineNotDateofTransaction(self, quiet=0,
-                                                  run=run_all_test):
-    """
-      Test that the conversion is not done when there is the start date
-      and the end date of a currency exchange line don't correspond to
-      the date of the transaction
-    """
-    if not run: return
-    if not quiet:
-       printAndLog('test_01_DateOfCurrencyExchangeLineNotDateofTransaction')
-    portal = self.getPortal()
-    self.organisation_module = self.portal.organisation_module
-    self.organisation1 = self.organisation_module.my_organisation
-    new_currency = portal.currency_module.newContent(portal_type='Currency')
-    new_currency.setReference('XOF')
-    new_currency.setTitle('Francs CFA')
-    new_currency.setBaseUnitQuantity(1.00)
-    get_transaction().commit()
-    self.tic()#execute transaction
-    self.organisation1.edit(price_currency=new_currency.getRelativeUrl())
-    euro = self.portal.currency_module.euro
-    accounting_module = self.portal.accounting_module
-    transaction = self._makeOne(
+    transaction2 = self._makeOne(
                portal_type='Purchase Invoice Transaction',
-               stop_date=DateTime('2008/09/08'),
+               stop_date=DateTime('2008/09/06'),
                source_section_value=self.organisation_module.supplier,
 	       lines=(dict(
 	           destination_value=self.account_module.goods_purchase,
                            destination_debit=500),
                       dict(destination_value=self.account_module.receivable,
                            destination_credit=500)))
-    transaction.AccountingTransaction_convertDestinationPrice(form_id='view')
-    line_list = transaction.contentValues(
-               portal_type=portal.getPortalAccountingMovementTypeList())
-    for line in line_list:
-	self.assertEquals(line.getDestinationTotalAssetPrice(),None)
+    transaction2.AccountingTransaction_convertDestinationPrice(form_id='view')
+    line_list = transaction2.contentValues(
+               portal_type=portal.getPortalAccountingMovementTypeList())
+    for line in line_list:
+	self.assertEquals(line.getDestinationTotalAssetPrice(),round(655.957*
+                                          line.getQuantity()))
+   
 
 def test_suite():
   suite = unittest.TestSuite()




More information about the Erp5-report mailing list