testERP5CurrencyExchangeLine.py 24 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
#############################################################################
#
# Copyright (c) 2006 Nexedi SARL and Contributors. All Rights Reserved.
#                    Aurelien Calonne <aurel@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import unittest
import os
from DateTime import DateTime
from zLOG import LOG
from Products.CMFCore.utils import _checkPermission
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.utils import reindex
from Testing import ZopeTestCase
from Products.ERP5Type.tests.Sequence import SequenceList
from Products.DCWorkflow.DCWorkflow import Unauthorized, ValidationFailed
from Products.ERP5.tests.testAccounting import AccountingTestCase
from Testing.ZopeTestCase.PortalTestCase import PortalTestCase
from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.SecurityManagement import getSecurityManager
from Products.ERP5Form.Document.Preference import Priority

QUIET = False
run_all_test = True


def printAndLog(msg):
  """
  A utility function to print a message
  to the standard output and to the LOG
  at the same time
  """
  msg = str(msg)
  ZopeTestCase._print('\n ' + msg)
  LOG('Testing... ', 0, msg)

class TestERP5CurrencyMixin(AccountingTestCase,ERP5TypeTestCase):
  """
  Mixin class for unit test of banking operations
  """
  username = 'username'
63 64 65 66 67
  def beforeTearDown(self):
    get_transaction().abort()
    # clear modules if necessary
    currency_list = ('euro', 'yen', 'usd')
    module = self.portal.currency_module
Jérome Perrin's avatar
Jérome Perrin committed
68
    module.manage_delObjects([x for x in module.objectIds()
69 70 71 72 73 74 75 76
                        if x not in currency_list])
    for currency_id in currency_list:
      currency = self.currency_module._getOb(currency_id, None)
      if currency is not None:
        currency.manage_delObjects([x.getId() for x in
                currency.objectValues(
                  portal_type='Currency Exchange Line')])
    get_transaction().commit()
Jérome Perrin's avatar
Jérome Perrin committed
77
    self.tic()
78 79 80
 
  def login(self,name=username, quiet=0, run=run_all_test):
    uf = self.getPortal().acl_users
81 82
    uf._doAddUser(self.username, '', ['Assignee', 'Assignor',
       'Author','Manager'], [])
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
    user = uf.getUserById(self.username).__of__(uf)
    newSecurityManager(None, user)
   
  def getBusinessTemplateList(self):
    """
      Return the list of business templates we need to run the test.
      This method is called during the initialization of the unit test by
      the unit test framework in order to know which business templates
      need to be installed to run the test on.
    """
    return ('erp5_base',
             'erp5_pdm',
            'erp5_accounting',
	    'erp5_accounting_ui_test'
            )

99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
  def test_01_CreateCurrencies(self, quiet=0, run=run_all_test):
    """
      Create currencies to be used for transactions
    """
    if not run: return
    if not quiet: printAndLog('test_01_CreateCurrencies')
    module = self.portal.currency_module
    currency1 = module.newContent(portal_type='Currency')
    currency1.setTitle('Euro')
    currency1.setReference('EUR')
    currency1.setBaseUnitQuantity(0.01)
    self.assertEquals(currency1.getTitle(), 'Euro')
    self.assertEquals(currency1.getReference(), 'EUR')
    self.assertEquals(currency1.getBaseUnitQuantity(), 0.01)
    currency1.validate()
    self.assertEquals(0, len(currency1.checkConsistency()))
    self.assertEquals(currency1.getValidationState(),'validated')
    currency2 = module.newContent(portal_type = 'Currency')
    currency2.setTitle('Francs CFA')
    currency2.setReference('XOF')
    currency2.setBaseUnitQuantity(1.00)
    self.assertEquals(currency2.getTitle(), 'Francs CFA')
    self.assertEquals(currency2.getReference(), 'XOF')
    self.assertEquals(currency2.getBaseUnitQuantity(), 1.00)
    currency2.validate()
    self.assertEquals(currency2.getValidationState(),'validated')
    self.assertEquals(0, len(currency2.checkConsistency()))
126 127 128 129
	
  def test_01_UseCurrencyExchangeLineForDestination(self, quiet=0,
                                                  run=run_all_test):
    """
130 131
      Create a currency exchange line for a currency and then
      convert destination price using that currency exchange line
132 133
    """
    if not run: return
134 135
    if not quiet:
      printAndLog('test_01_UseCurrencyExchangeLineForDestination')
136 137 138
    portal = self.getPortal()
    self.organisation_module = self.portal.organisation_module
    self.organisation1 = self.organisation_module.my_organisation
139 140
    new_currency = portal.currency_module.newContent(
                          portal_type='Currency')
141 142 143 144 145
    new_currency.setReference('XOF')
    new_currency.setTitle('Francs CFA')
    new_currency.setBaseUnitQuantity(1.00)
    get_transaction().commit()
    self.tic()#execute transaction
146 147
    self.organisation1.edit(
                    price_currency=new_currency.getRelativeUrl())
148 149
    euro = self.portal.currency_module.euro
    x_curr_ex_line = euro.newContent(
150 151
	                  portal_type='Currency Exchange Line',
                  price_currency=new_currency.getRelativeUrl())
152 153 154
    x_curr_ex_line.setTitle('Euro to Francs CFA')
    x_curr_ex_line.setBasePrice(655.957)
    x_curr_ex_line.setStartDate(DateTime(2008,9,8))
155 156 157 158 159
    x_curr_ex_line.setStopDate(DateTime(2008,9,10))
    self.assertEquals(x_curr_ex_line.getTitle(),
                'Euro to Francs CFA')
    self.assertEquals(x_curr_ex_line.getPriceCurrencyTitle(),
                          'Francs CFA')
160 161
    self.assertEquals(x_curr_ex_line.getBasePrice(),655.957)
    x_curr_ex_line.validate()
162 163
    self.assertEquals(x_curr_ex_line.getValidationState(),
                           'validated')
164 165 166 167
    accounting_module = self.portal.accounting_module
    transaction = self._makeOne(
               portal_type='Purchase Invoice Transaction',
               stop_date=DateTime('2008/09/08'),
168
            source_section_value=self.organisation_module.supplier,
169
	       lines=(dict(
170
	       destination_value=self.account_module.goods_purchase,
171
                           destination_debit=500),
172
              dict(destination_value=self.account_module.receivable,
173 174 175
                           destination_credit=500)))
    transaction.AccountingTransaction_convertDestinationPrice(form_id='view')
    line_list = transaction.contentValues(
176
           portal_type=portal.getPortalAccountingMovementTypeList())
177
    for line in line_list:
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253
	self.assertEquals(line.getDestinationTotalAssetPrice(),
             round(655.957*line.getQuantity()))
                                        
 		
  def test_01_CreateEmptyCurrencyExchangeLineForDestination(
                self, quiet=0,run=run_all_test):
    """
      Create empty currency exchange lines for currencies,
      and verify that only the one that matches the criteria will
      be selected for the conversion
    """
    if not run: return
    if not quiet:
      printAndLog(
            'test_01_CreateEmptyCurrencyExchangeLineForDestination')
    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())
    x_curr_ex_line.setTitle('Euro to Francs CFA')
    x_curr_ex_line.setBasePrice(655.957)
    x_curr_ex_line.setStartDate(DateTime(2008,9,8))
    x_curr_ex_line.setStopDate(DateTime(2008,9,10))
    self.assertEquals(x_curr_ex_line.getTitle(), 
                      'Euro to Francs CFA')
    self.assertEquals(x_curr_ex_line.getPriceCurrencyTitle(),
                                         'Francs CFA')
    self.assertEquals(x_curr_ex_line.getBasePrice(),655.957)
    x_curr_ex_line.validate()
    self.assertEquals(x_curr_ex_line.getValidationState(),
                            'validated')
    yen = self.portal.currency_module.yen
    yen_line1 = yen.newContent(
                          portal_type='Currency Exchange Line')
    yen_line2 = yen.newContent(
                          portal_type='Currency Exchange Line')
                          
    usd = self.portal.currency_module.usd
    usd_line1 = usd.newContent(
                          portal_type='Currency Exchange Line')
    usd_line2 = usd.newContent(
                          portal_type='Currency Exchange Line')
    
    euro_line = euro.newContent(
                           portal_type='Currency Exchange Line')
    euro_line.validate()
    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(),
                   round(655.957*line.getQuantity()))	
                   	  
254 255 256
  def test_01_UseCurrencyExchangeLineForSource(self, quiet=0,
                                                  run=run_all_test):
    """
257 258
      Create a currency exchange line for a currency and then
      convert
259 260 261
      source price using that currency exchange line
    """
    if not run: return
262 263
    if not quiet:
      printAndLog('test_01_UseCurrencyExchangeLineForSource')
264 265 266 267 268 269 270 271 272
    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
273 274
    self.organisation1.edit(
              price_currency=new_currency.getRelativeUrl())
275 276
    euro = self.portal.currency_module.euro
    x_curr_ex_line = euro.newContent(
277 278
	                    portal_type='Currency Exchange Line',
		price_currency=new_currency.getRelativeUrl())
279 280 281
    x_curr_ex_line.setTitle('Euro to Francs CFA')
    x_curr_ex_line.setBasePrice(655.957)
    x_curr_ex_line.setStartDate(DateTime(2008,9,8))
282 283 284 285 286
    x_curr_ex_line.setStopDate(DateTime(2008,9,10))
    self.assertEquals(x_curr_ex_line.getTitle(),
                   'Euro to Francs CFA')
    self.assertEquals(x_curr_ex_line.getPriceCurrencyTitle(),
                            'Francs CFA')
287 288
    self.assertEquals(x_curr_ex_line.getBasePrice(),655.957)
    x_curr_ex_line.validate()
289 290
    self.assertEquals(x_curr_ex_line.getValidationState(),
                         'validated')
291 292 293 294
    accounting_module = self.portal.accounting_module
    transaction = self._makeOne(
               portal_type='Sale Invoice Transaction',
               start_date=DateTime('2008/09/08'),
295 296
        destination_section_value=self.organisation_module.supplier,
        lines=(dict(source_value=self.account_module.goods_purchase,
297
                           source_debit=500),
298
                   dict(source_value=self.account_module.receivable,
299
                           source_credit=500)))
300 301
    transaction.AccountingTransaction_convertSourcePrice(
                   form_id='view')
302
    line_list = transaction.contentValues(
303
           portal_type=portal.getPortalAccountingMovementTypeList())
304
    for line in line_list:
305 306
	self.assertEquals(line.getSourceTotalAssetPrice(),
                         round(655.957*line.getQuantity()))
307 308 309 310 311 312 313 314
					  
  def test_01_NoCurrencyExchangeLineForResourceCurrency(self, quiet=0,
                                                  run=run_all_test):
    """
      Test that the conversion is not done when there is no currency 
      exchange line defined for the date of the transaction
    """
    if not run: return
315 316
    if not quiet:
      printAndLog('test_01_NoCurrencyExchangeLineForResource')
317 318 319
    portal = self.getPortal()
    self.organisation_module = self.portal.organisation_module
    self.organisation1 = self.organisation_module.my_organisation
320 321
    new_currency = portal.currency_module.newContent(
                portal_type='Currency')
322 323 324 325 326
    new_currency.setReference('XOF')
    new_currency.setTitle('Francs CFA')
    new_currency.setBaseUnitQuantity(1.00)
    get_transaction().commit()
    self.tic()#execute transaction
327 328
    self.organisation1.edit(
                price_currency=new_currency.getRelativeUrl())
329 330 331 332 333
    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'),
334
            source_section_value=self.organisation_module.supplier,
335
	       lines=(dict(
336
	       destination_value=self.account_module.goods_purchase,
337
                           destination_debit=500),
338
              dict(destination_value=self.account_module.receivable,
339
                           destination_credit=500)))
340 341
    transaction.AccountingTransaction_convertDestinationPrice(
                        form_id='view')
342
    line_list = transaction.contentValues(
343
           portal_type=portal.getPortalAccountingMovementTypeList())
344 345 346 347 348 349 350 351
    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
352 353 354
      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
355 356 357
    """
    if not run: return
    if not quiet:
358 359
       printAndLog(
           'test_01_DateOfCurrencyExchangeLineNotDateofTransaction')
360 361 362
    portal = self.getPortal()
    self.organisation_module = self.portal.organisation_module
    self.organisation1 = self.organisation_module.my_organisation
363 364
    new_currency = portal.currency_module.newContent(
    portal_type='Currency')
365 366 367 368 369
    new_currency.setReference('XOF')
    new_currency.setTitle('Francs CFA')
    new_currency.setBaseUnitQuantity(1.00)
    get_transaction().commit()
    self.tic()#execute transaction
370 371
    self.organisation1.edit(
               price_currency=new_currency.getRelativeUrl())
372
    euro = self.portal.currency_module.euro
373
    x_curr_ex_line = euro.newContent(
374 375
	                    portal_type='Currency Exchange Line',
	              price_currency=new_currency.getRelativeUrl())
376 377 378 379
    x_curr_ex_line.setTitle('Euro to Francs CFA')
    x_curr_ex_line.setBasePrice(655.957)
    x_curr_ex_line.setStartDate(DateTime(2008,9,6))
    x_curr_ex_line.setStopDate(DateTime(2008,9,7))
380 381 382 383
    self.assertEquals(x_curr_ex_line.getTitle(), 
              'Euro to Francs CFA')
    self.assertEquals(x_curr_ex_line.getPriceCurrencyTitle(),
               'Francs CFA')
384 385
    self.assertEquals(x_curr_ex_line.getBasePrice(),655.957)
    x_curr_ex_line.validate()
386 387
    self.assertEquals(x_curr_ex_line.getValidationState(),
                               'validated')
388
    accounting_module = self.portal.accounting_module
389
    transaction1 = self._makeOne(
390 391
               portal_type='Purchase Invoice Transaction',
               stop_date=DateTime('2008/09/08'),
392 393 394
            source_section_value=self.organisation_module.supplier,
	        lines=(dict(
	       destination_value=self.account_module.goods_purchase,
395
                           destination_debit=500),
396
              dict(destination_value=self.account_module.receivable,
397
                           destination_credit=500)))
398 399
    transaction1.AccountingTransaction_convertDestinationPrice(
                              form_id='view')
400
    line_list = transaction1.contentValues(
401
           portal_type=portal.getPortalAccountingMovementTypeList())
402 403
    for line in line_list:
	self.assertEquals(line.getDestinationTotalAssetPrice(),None)
404 405 406
    transaction2 = self._makeOne(
               portal_type='Purchase Invoice Transaction',
               stop_date=DateTime('2008/09/06'),
407
             source_section_value=self.organisation_module.supplier,
408
	       lines=(dict(
409
	       destination_value=self.account_module.goods_purchase,
410
                           destination_debit=500),
411
              dict(destination_value=self.account_module.receivable,
412
                           destination_credit=500)))
413 414
    transaction2.AccountingTransaction_convertDestinationPrice(
                  form_id='view')
415
    line_list = transaction2.contentValues(
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541
           portal_type=portal.getPortalAccountingMovementTypeList())
    for line in line_list:
	self.assertEquals(line.getDestinationTotalAssetPrice(),
                    round(655.957*line.getQuantity()))
                                          
  def test_01_CreateCELWithNoReferenceCurrency(
              self, quiet=0,run=run_all_test):
    """
      Create a currency exchange line with no reference currency
      and verify that the CEL won't apply for the currency
    """
    if not run: return
    if not quiet:
      printAndLog('test_01_CreateCELWithNoReferenceCurrency')
    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')
    x_curr_ex_line.setTitle('Euro to Francs CFA')
    x_curr_ex_line.setBasePrice(655.957)
    x_curr_ex_line.setStartDate(DateTime(2008,9,8))
    x_curr_ex_line.setStopDate(DateTime(2008,9,10))
    self.assertEquals(x_curr_ex_line.getTitle(), 
                     'Euro to Francs CFA')
    self.assertEquals(x_curr_ex_line.getPriceCurrency(),None)
    self.assertEquals(x_curr_ex_line.getBasePrice(),655.957)
    x_curr_ex_line.validate()
    self.assertEquals(x_curr_ex_line.getValidationState(),
                          'validated')
    
    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_CreateCELWithNoBasePrice(
              self, quiet=0,run=run_all_test):
    """
      Create two currency exchange lines with no base and 
      verify that only one of the CEL will apply for the currency
    """
    if not run: return
    if not quiet:
      printAndLog('test_01_CreateCELWithNoBasePrice')
    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
    
    euro_line1 = euro.newContent(
                              portal_type='Currency Exchange Line',
                       price_currency=new_currency.getRelativeUrl())
    euro_line1.setTitle('Euro to Francs CFA')
    euro_line1.setBasePrice(655.957)
    euro_line1.setStartDate(DateTime(2008,9,8))
    euro_line1.setStopDate(DateTime(2008,9,10))
    self.assertEquals(euro_line1.getTitle(), 'Euro to Francs CFA')
    self.assertEquals(euro_line1.getPriceCurrencyTitle(),
                            'Francs CFA')
    self.assertEquals(euro_line1.getBasePrice(),655.957)
    euro_line1.validate()
    self.assertEquals(euro_line1.getValidationState(),
                                 'validated')
    euro_line2 = euro.newContent(
                              portal_type='Currency Exchange Line',
                       price_currency=new_currency.getRelativeUrl())
    euro_line2.setTitle('Euro to Francs CFA')
    euro_line2.setStartDate(DateTime(2008,9,8))
    euro_line2.setStopDate(DateTime(2008,9,10))
    self.assertEquals(euro_line2.getTitle(), 'Euro to Francs CFA')
    self.assertEquals(euro_line2.getPriceCurrencyTitle(),
                            'Francs CFA')
    self.assertEquals(euro_line2.getBasePrice(),None)
    euro_line2.validate()
    
    self.assertEquals(euro_line2.getValidationState(),
                                 'validated')
    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())
542
    for line in line_list:
543 544 545
        self.assertEquals(line.getDestinationTotalAssetPrice(),
                 round(655.957*line.getQuantity()))
    
546
   
547 548 549 550

def test_suite():
  suite = unittest.TestSuite()
  suite.addTest(unittest.makeSuite(TestERP5CurrencyMixin))
Jérome Perrin's avatar
Jérome Perrin committed
551
  return suite