Browse Source

[IMP] Backport from master at 04daefd2d1

pull/142/head
Laurent Mignon 9 years ago
committed by Nicolas JEUDY
parent
commit
6e683d8db3
  1. 3
      account_bank_statement_import_ofx/__init__.py
  2. 5
      account_bank_statement_import_ofx/__openerp__.py
  3. 7
      account_bank_statement_import_ofx/account_bank_statement_import_ofx.py
  4. 6
      account_bank_statement_import_ofx/tests/test_import_bank_statement.py

3
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

5
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,
}

7
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]

6
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)
Loading…
Cancel
Save