From 0564a7a88790aa9117719682369965e76e94f3b6 Mon Sep 17 00:00:00 2001
From: Vincent Pelletier <vincent@nexedi.com>
Date: Fri, 18 Sep 2009 15:45:36 +0000
Subject: [PATCH] Split createBankAccount into 2 methods: - one creating a bank
 account - one providing an inventory for that bank account

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29110 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Banking/tests/TestERP5BankingMixin.py | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/product/ERP5Banking/tests/TestERP5BankingMixin.py b/product/ERP5Banking/tests/TestERP5BankingMixin.py
index 69137c0c50..b6e5fbcc7a 100644
--- a/product/ERP5Banking/tests/TestERP5BankingMixin.py
+++ b/product/ERP5Banking/tests/TestERP5BankingMixin.py
@@ -850,9 +850,12 @@ class TestERP5BankingMixin:
       
     # validate this bank account for payment
     bank_account.validate()
-    if amount == 0:
-      return bank_account
-    # we need to put some money on this bank account
+    if amount:
+      # we need to put some money on this bank account
+      self.createBankAccountInventory(bank_account, amount, inv_date=inv_date)
+    return bank_account
+
+  def createBankAccountInventory(self, bank_account, amount, inv_date=None):
     if not hasattr(self, 'bank_account_inventory'):
       self.bank_account_inventory = self.bank_account_inventory_module.newContent(id='account_inventory_group',
                                                                                 portal_type='Bank Account Inventory Group',
@@ -868,7 +871,7 @@ class TestERP5BankingMixin:
     account_inventory_line_id = 'account_inventory_line_%s' %(self.account_inventory_number,)
     inventory_line = inventory.newContent(id=account_inventory_line_id,
                                           portal_type='Bank Account Inventory Line',
-                                          resource_value=currency,
+                                          resource_value=bank_account.getPriceCurrencyValue(),
                                           quantity=amount)
 
 
@@ -877,8 +880,6 @@ class TestERP5BankingMixin:
       inventory.deliver()
 
     self.account_inventory_number += 1
-    return bank_account
-
 
   def createCheckbook(self, id, vault, bank_account, min, max, date=None):
     """
-- 
2.30.9