Use ofx file data for statement total_amount and start/end balance

issue8879
review262751002
This commit is contained in:
David Harper
2020-01-10 17:01:28 +01:00
parent df28c2a36d
commit ecaf40da29
3 changed files with 11 additions and 3 deletions
+5 -1
View File
@@ -58,7 +58,11 @@ class StatementImport(metaclass=PoolMeta):
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
+2 -2
View File
@@ -48,11 +48,11 @@ NEWFILEUID:NONE
</STMTTRN>
</BANKTRANLIST>
<LEDGERBAL>
<BALAMT>100.00
<BALAMT>500.00
<DTASOF>20180222
</LEDGERBAL>
<AVAILBAL>
<BALAMT>100.00
<BALAMT>500.00
<DTASOF>20180222
</AVAILBAL>
</STMTRS>
+4
View File
@@ -102,6 +102,10 @@ Check Statement::
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