On Mon, May 2, 2016 at 10:58 AM, Filippo Tampieri < [email protected]> wrote:
> My use case is due to the interaction of the deposit_in_transit plugin and > the transaction completer I use during import. > > The transaction completer relies on the past entries to figure out which > account to assign to the second posting of imported entries. > The deposit_in_transit plugin helps me deal with transactions such as > credit card payments that appear in both the bank statement and the credit > card statement. > For example, when I import my bank account statement, the transaction > completer would complete an entry like this: > > 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. > A simpler and better solution would be for your plugin to mark your auto-generated transactions (or even the postings themselves) with metadata to leave a trace to indicate they're to be ignored by the plugin for learning. -- You received this message because you are subscribed to the Google Groups "Beancount" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CAK21%2BhPPt2ObEm1zh_3wUb9oqD9KkNb40itPyGTAhTif9V%3DiZw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
