2016-03-23 * "Payment to AMEX"
Assets:MyBankAccount -1261.98 CAD
Assets:DIT:Amex
When I import my credit card statement, the transaction completer would complete the corresponding entry like this:
2016-03-24 * "PAYMENT RECEIVED - THANK YOU" Liabilities:Amex 1261.98 CAD
Assets:DIT:MyBankAccount
As you see, the first entry uses Assets:DIT:Amex to indicate that it is depositing funds in the Amex account rather than using the Assets:Amex account directly.
Similarly, the second entry receives the funds from Assets:DIT:MyBankAccount rather than directly from Assets:MyBankAccount.
This allows the importers to import all entries and I do not have to worry about detecting a transaction that is common to the two statements and commenting it out on one side and possibly dealing with the different dates of the two entries (which could cause a problem with balance assertions in certain cases).
Instead, I run the deposit_in_transit plugin that automatically creates a new entry that ties to first two:
2016-03-24 * "Payment to AMEX / PAYMENT RECEIVED - THANK YOU"
Assets:DIT:MyBankAccount 1261.98 CAD
Assets:DIT:Amex
It also tags pending deposits and tags and links cleared transactions, but that is beyond the point of this discussion.
The problem I have is caused by an extension I made to the deposit_in_transit plugin. When the two entries happen on the same date, accountants will usually remove the transaction from the deposit-in-transit account (I use a pair of deposit-in-transit accounts, but just because I want those account names to give you info about the source and destination of the funds in the original entries) and use the original source and destination accounts directly. So, my plugin will do this as well and when faced with two entries such as:
2016-03-23 * "Payment to AMEX"
Assets:MyBankAccount -1261.98 CAD
Assets:DIT:Amex
2016-03-23 * "PAYMENT RECEIVED - THANK YOU"
Liabilities:Amex 1261.98 CAD
Assets:DIT:MyBankAccount
(note that the only thing changed is that the two entries now share the same date), instead of adding a new entry to link them, it will replace them with a single entry:
2016-03-23 * "Payment to AMEX / PAYMENT RECEIVED - THANK YOU"
Assets:MyBankAccount -1261.98 CAD
Liabilities:Amex 1261.98 CAD
Nice and tidy.
But now, here is the problem with the import stage; when importing an entry such as:
2016-03-23 * "Payment to AMEX"
Assets:MyBankAccount -1261.98 CAD
The transaction completer will look at past entries to come up with a reasonable second posting; if it used the results of the deposit_in_transit plugin, it would use:
Liabilities:Amex
as the second leg, while I want it to use the same account that I use in my beancount file, i.e.:
Assets:DIT:Amex
Otherwise, I will end up with two entries (one from the bank statement and one from the credit card statement) describing the same transaction!
So, my solution would be to disable the deposit_in_transit plugin when using bean-extract.