Skip to content

Commit

Permalink
Use effective date for credit card with deferred payment.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
sathlan committed Mar 27, 2019
1 parent c2d5c2f commit 0214d51
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion ledgerautosync/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,18 @@ def convert(self, txn):
posting = Posting(self.name,
Amount(txn.amount, self.currency),
metadata=posting_metadata)
effective_date = None
logged_date = txn.date

# When the user date is different from the date then we
# need to add an effective transaction.
if txn.user_date is not None:
if txn.user_date != txn.date:
effective_date = txn.date
logged_date = txn.user_date
return Transaction(
date=txn.date,
date=logged_date,
aux_date=effective_date,
payee=self.format_payee(txn),
postings=[
posting,
Expand Down

0 comments on commit 0214d51

Please sign in to comment.