Browse Source

Merge pull request #91 from akretion/8.0-fix-ofx-balance

[8.0][FIX] Start/end balance on OFX statement
pull/109/head
Pedro M. Baeza 8 years ago
committed by GitHub
parent
commit
0c227dd794
  1. 6
      account_bank_statement_import_ofx/account_bank_statement_import_ofx.py
  2. 4
      account_bank_statement_import_ofx/tests/test_import_bank_statement.py

6
account_bank_statement_import_ofx/account_bank_statement_import_ofx.py

@ -83,12 +83,12 @@ class AccountBankStatementImport(models.TransientModel):
"The file might not be valid.\n\n %s" % e.message
))
balance = float(ofx.account.statement.balance)
vals_bank_statement = {
'name': ofx.account.number,
'transactions': transactions,
'balance_start': ofx.account.statement.balance,
'balance_end_real':
float(ofx.account.statement.balance) + total_amt,
'balance_start': balance - total_amt,
'balance_end_real': balance,
}
return ofx.account.statement.currency, ofx.account.number, [
vals_bank_statement]

4
account_bank_statement_import_ofx/tests/test_import_bank_statement.py

@ -23,8 +23,8 @@ class TestOfxFile(TransactionCase):
bank_statement.import_file()
bank_st_record = self.bank_statement_model.search(
[('name', '=', '123456')])[0]
self.assertEquals(bank_st_record.balance_start, 2156.56)
self.assertEquals(bank_st_record.balance_end_real, 1796.56)
self.assertEquals(bank_st_record.balance_start, 2516.56)
self.assertEquals(bank_st_record.balance_end_real, 2156.56)
line = bank_st_record.line_ids[0]
self.assertEquals(line.name, 'Agrolait')

Loading…
Cancel
Save