Commits

Virgil Dupras committed a387397

[#353 state:fixed] Include all entries in QIF exports.

Previously, a transaction doing a transfer between asset/liability account would
only figure once in QIF exports but it would confuse some (lesser) financial
apps at import time.

Comments (0)

Files changed (3)

core/saver/qif.py

         return '%1.2f' % amount.value if amount else '0.00'
     
     accounts = [a for a in accounts if a.is_balance_sheet_account()]
-    txns_seen = set()
     lines = []
     for account in accounts:
         qif_account_type = 'Oth L' if account.type == AccountType.Liability else 'Bank'
         if daterange is not None:
             entries = [e for e in entries if e.date in daterange]
         for entry in entries:
-            if entry.transaction in txns_seen:
-                continue
-            txns_seen.add(entry.transaction)
             lines.append('D%s' % format_date(entry.date, 'MM/dd/yyyy'))
             lines.append('T%s' % format_amount_for_qif(entry.amount))
             if entry.description:

core/tests/loader/qif_test.py

     eq_(len(loader.transactions), 1) # the transactions hasn't been doubled.
     
 def test_export_to_qif(tmpdir):
-    # When there's a transfer between 2 assets, only put an entry in one of the accounts
+    # When there's a transfer between 2 assets, export all entries (otherwise some apps will import
+    # the QIF wrongly)
     app = TestApp()
     app.add_account('first')
     app.add_account('second')

core/tests/testdata/qif/export_ref_transfer.qif

 B42.00
 TBank
 ^
-!Type:Bank
+!Type:Bank
+D01/03/2009
+T42.00
+Mtransfer
+Lfirst
+^