changeset c0ab803f498e in modules/account_statement_ofx:5.4 details: https://hg.tryton.org/modules/account_statement_ofx?cmd=changeset;node=c0ab803f498e description: Use ofx file data for statement total_amount and start/end balance
issue8879 review262751002 (grafted from 91468eba7c56e54fa23b8019031e7006d8709401) diffstat: account.py | 6 +++++- tests/OFX.txt | 4 ++-- tests/scenario_account_statement_ofx.rst | 4 ++++ 3 files changed, 11 insertions(+), 3 deletions(-) diffs (47 lines): diff -r e4d02144d9b1 -r c0ab803f498e account.py --- a/account.py Mon Nov 04 12:54:49 2019 +0100 +++ b/account.py Fri Jan 10 17:01:28 2020 +0100 @@ -58,7 +58,11 @@ raise ImportStatementError( gettext('account_statement_ofx.msg_import_no_statement')) statement.date = ofx_account.statement.balance_date.date() - statement.total_amount = ofx_account.statement.balance + total_amount = sum( + t.amount for t in ofx_account.statement.transactions) + statement.total_amount = total_amount + statement.start_balance = ofx_account.statement.balance - total_amount + statement.end_balance = ofx_account.statement.balance statement.number_of_lines = len(ofx_account.statement.transactions) return statement diff -r e4d02144d9b1 -r c0ab803f498e tests/OFX.txt --- a/tests/OFX.txt Mon Nov 04 12:54:49 2019 +0100 +++ b/tests/OFX.txt Fri Jan 10 17:01:28 2020 +0100 @@ -48,11 +48,11 @@ </STMTTRN> </BANKTRANLIST> <LEDGERBAL> -<BALAMT>100.00 +<BALAMT>500.00 <DTASOF>20180222 </LEDGERBAL> <AVAILBAL> -<BALAMT>100.00 +<BALAMT>500.00 <DTASOF>20180222 </AVAILBAL> </STMTRS> diff -r e4d02144d9b1 -r c0ab803f498e tests/scenario_account_statement_ofx.rst --- a/tests/scenario_account_statement_ofx.rst Mon Nov 04 12:54:49 2019 +0100 +++ b/tests/scenario_account_statement_ofx.rst Fri Jan 10 17:01:28 2020 +0100 @@ -102,6 +102,10 @@ Decimal('100.00') >>> statement.number_of_lines 1 + >>> statement.start_balance + Decimal('400.00') + >>> statement.end_balance + Decimal('500.00') >>> len(statement.origins) 1 >>> origin, = statement.origins