From 6e683d8db355f67b4742a4076cbba3a7f42bd037 Mon Sep 17 00:00:00 2001 From: Laurent Mignon Date: Fri, 20 Mar 2015 11:48:55 +0100 Subject: [PATCH] [IMP] Backport from master at 04daefd2d101d90daf5782173b95f31f3bd9e1b6 --- account_bank_statement_import_ofx/__init__.py | 3 +-- account_bank_statement_import_ofx/__openerp__.py | 5 +++-- .../account_bank_statement_import_ofx.py | 7 +++---- .../tests/test_import_bank_statement.py | 6 +++--- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/account_bank_statement_import_ofx/__init__.py b/account_bank_statement_import_ofx/__init__.py index 44bd24d..9955438 100644 --- a/account_bank_statement_import_ofx/__init__.py +++ b/account_bank_statement_import_ofx/__init__.py @@ -1,4 +1,3 @@ # -*- encoding: utf-8 -*- -from . import account_bank_statement_import_ofx -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: +import account_bank_statement_import_ofx diff --git a/account_bank_statement_import_ofx/__openerp__.py b/account_bank_statement_import_ofx/__openerp__.py index 8a10b59..c71cd77 100644 --- a/account_bank_statement_import_ofx/__openerp__.py +++ b/account_bank_statement_import_ofx/__openerp__.py @@ -25,9 +25,10 @@ base account_bank_statement_import module has been imported, or manually create periods for the year 2013. """, 'data' : [], + 'depends': ['account_bank_statement_import'], 'demo': [ 'demo/demo_data.xml', - ], - 'auto_install': False, + ], + 'auto_install': True, 'installable': True, } diff --git a/account_bank_statement_import_ofx/account_bank_statement_import_ofx.py b/account_bank_statement_import_ofx/account_bank_statement_import_ofx.py index cf0eb8a..0442f03 100644 --- a/account_bank_statement_import_ofx/account_bank_statement_import_ofx.py +++ b/account_bank_statement_import_ofx/account_bank_statement_import_ofx.py @@ -14,8 +14,7 @@ _logger = logging.getLogger(__name__) try: from ofxparse import OfxParser as ofxparser except ImportError: - _logger.error("OFX parser unavailable because the `ofxparse` Python library cannot be found." - "It can be downloaded and installed from `https://pypi.python.org/pypi/ofxparse`.") + _logger.warn("ofxparse not found, OFX parsing disabled.") ofxparser = None class account_bank_statement_import(osv.TransientModel): @@ -63,7 +62,7 @@ class account_bank_statement_import(osv.TransientModel): vals_bank_statement = { 'name': ofx.account.routing_number, 'transactions': transactions, - 'balance_start': float(ofx.account.statement.balance) - total_amt, - 'balance_end_real': float(ofx.account.statement.balance), + 'balance_start': ofx.account.statement.balance, + 'balance_end_real': float(ofx.account.statement.balance) + total_amt, } return ofx.account.statement.currency, ofx.account.number, [vals_bank_statement] diff --git a/account_bank_statement_import_ofx/tests/test_import_bank_statement.py b/account_bank_statement_import_ofx/tests/test_import_bank_statement.py index ebdbe11..2391fd1 100644 --- a/account_bank_statement_import_ofx/tests/test_import_bank_statement.py +++ b/account_bank_statement_import_ofx/tests/test_import_bank_statement.py @@ -25,8 +25,8 @@ class TestOfxFile(TransactionCase): bank_statement_id = self.statement_import_model.create(cr, uid, dict( data_file=ofx_file, )) - self.statement_import_model.import_file(cr, uid, [bank_statement_id], {'allow_auto_create_journal': True}) + self.statement_import_model.import_file(cr, uid, [bank_statement_id]) statement_id = self.bank_statement_model.search(cr, uid, [('name', '=', '000000123')])[0] bank_st_record = self.bank_statement_model.browse(cr, uid, statement_id) - self.assertEquals(bank_st_record.balance_start, 2516.56) - self.assertEquals(bank_st_record.balance_end_real, 2156.56) + self.assertEquals(bank_st_record.balance_start, 2156.56) + self.assertEquals(bank_st_record.balance_end_real, 1796.56)