diff --git a/addons/account_bank_statement_import_ofx/account_bank_statement_import_ofx.py b/addons/account_bank_statement_import_ofx/account_bank_statement_import_ofx.py
index bf36347d88bad59c80d70b73a93d550fe414b87f..f6d0384dd8618635a2be1fe43c9d76c171acec07 100644
--- a/addons/account_bank_statement_import_ofx/account_bank_statement_import_ofx.py
+++ b/addons/account_bank_statement_import_ofx/account_bank_statement_import_ofx.py
@@ -32,37 +32,51 @@ class account_bank_statement_import(osv.TransientModel):
         if not ofx:
             return super(account_bank_statement_import, self)._parse_file(cr, uid, data_file, context=context)
 
-        transactions = []
-        total_amt = 0.00
-        try:
-            for transaction in ofx.account.statement.transactions:
-                # Since ofxparse doesn't provide account numbers, we'll have to find res.partner and res.partner.bank here
-                # (normal behavious is to provide 'account_number', which the generic module uses to find partner/bank)
-                bank_account_id = partner_id = False
-                ids = self.pool.get('res.partner.bank').search(cr, uid, [('owner_name', '=', transaction.payee)], context=context)
-                if ids:
-                    bank_account_id = bank_account_id = ids[0]
-                    partner_id = self.pool.get('res.partner.bank').browse(cr, uid, bank_account_id, context=context).partner_id.id
-                vals_line = {
-                    'date': transaction.date,
-                    'name': transaction.payee + (transaction.memo and ': ' + transaction.memo or ''),
-                    'ref': transaction.id,
-                    'amount': transaction.amount,
-                    'unique_import_id': transaction.id,
-                    'bank_account_id': bank_account_id,
-                    'partner_id': partner_id,
-                }
-                total_amt += float(transaction.amount)
-                transactions.append(vals_line)
-        except Exception, e:
-            raise UserError(_("The following problem occurred during import. The file might not be valid.\n\n %s" % e.message))
+        vals_bank_statement = []
+        account_lst = set()
+        currency_lst = set()
+        for account in ofx.accounts:
+            account_lst.add(account.number)
+            currency_lst.add(account.statement.currency)
+            transactions = []
+            total_amt = 0.00
+            try:
+                for transaction in account.statement.transactions:
+                    # Since ofxparse doesn't provide account numbers, we'll have to find res.partner and res.partner.bank here
+                    # (normal behavious is to provide 'account_number', which the generic module uses to find partner/bank)
+                    bank_account_id = partner_id = False
+                    ids = self.pool.get('res.partner.bank').search(cr, uid, [('owner_name', '=', transaction.payee)], context=context)
+                    if ids:
+                        bank_account_id = bank_account_id = ids[0]
+                        partner_id = self.pool.get('res.partner.bank').browse(cr, uid, bank_account_id, context=context).partner_id.id
+                    vals_line = {
+                        'date': transaction.date,
+                        'name': transaction.payee + (transaction.memo and ': ' + transaction.memo or ''),
+                        'ref': transaction.id,
+                        'amount': transaction.amount,
+                        'unique_import_id': transaction.id,
+                        'bank_account_id': bank_account_id,
+                        'partner_id': partner_id,
+                    }
+                    total_amt += float(transaction.amount)
+                    transactions.append(vals_line)
+            except Exception, e:
+                raise UserError(_("The following problem occurred during import. The file might not be valid.\n\n %s" % e.message))
+
+            vals_bank_statement.append({
+                'name': account.routing_number,
+                'transactions': transactions,
+                # WARNING: the provided ledger balance is not necessarily the ending balance of the statement
+                # see https://github.com/odoo/odoo/issues/3003
+                'balance_start': float(account.statement.balance) - total_amt,
+                'balance_end_real': account.statement.balance,
+            })
+
+        if account_lst and len(account_lst) == 1:
+            account_lst = account_lst.pop()
+            currency_lst = currency_lst.pop()
+        else:
+            account_lst = None
+            currency_lst = None
 
-        vals_bank_statement = {
-            'name': ofx.account.routing_number,
-            'transactions': transactions,
-            # WARNING: the provided ledger balance is not necessarily the ending balance of the statement
-            # see https://github.com/odoo/odoo/issues/3003
-            'balance_start': float(ofx.account.statement.balance) - total_amt,
-            'balance_end_real': ofx.account.statement.balance,
-        }
-        return ofx.account.statement.currency, ofx.account.number, [vals_bank_statement]
+        return currency_lst, account_lst, vals_bank_statement
diff --git a/addons/account_bank_statement_import_ofx/test_ofx_file/test_ofx.ofx b/addons/account_bank_statement_import_ofx/test_ofx_file/test_ofx.ofx
index 37df4d0c996d976437fa3ec9cc4137c3f0116a25..c13c9f003e09f2bcdd10ae5fcb022272eba0ac71 100644
--- a/addons/account_bank_statement_import_ofx/test_ofx_file/test_ofx.ofx
+++ b/addons/account_bank_statement_import_ofx/test_ofx_file/test_ofx.ofx
@@ -86,7 +86,7 @@
       <CCSTMTRS>
         <CURDEF>USD</CURDEF>
         <CCACCTFROM>
-          <ACCTID>123412341234</ACCTID>
+          <ACCTID>123456</ACCTID>
         </CCACCTFROM>
         <BANKTRANLIST>
         </BANKTRANLIST>