mirror of
https://github.com/OCA/bank-statement-import.git
synced 2025-01-20 12:37:43 +02:00
[IMP] Backport from master at 04daefd2d101d90daf5782173b95f31f3bd9e1b6
This commit is contained in:
committed by
Alexis de Lattre
parent
a2bfc4bb6a
commit
3a2a0839ce
@@ -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
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user