Skip to content

Commit 0214d51

Browse files
committed
Use effective date for credit card with deferred payment.
If the DTUSER is different from the DTPOSTED in an transaction then we have a deferred payment. Use the effective date in ledger for such case. Closes: #69
1 parent c2d5c2f commit 0214d51

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

ledgerautosync/converter.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -413,8 +413,18 @@ def convert(self, txn):
413413
posting = Posting(self.name,
414414
Amount(txn.amount, self.currency),
415415
metadata=posting_metadata)
416+
effective_date = None
417+
logged_date = txn.date
418+
419+
# When the user date is different from the date then we
420+
# need to add an effective transaction.
421+
if txn.user_date is not None:
422+
if txn.user_date != txn.date:
423+
effective_date = txn.date
424+
logged_date = txn.user_date
416425
return Transaction(
417-
date=txn.date,
426+
date=logged_date,
427+
aux_date=effective_date,
418428
payee=self.format_payee(txn),
419429
postings=[
420430
posting,

0 commit comments

Comments
 (0)