So I think the real problem here is that this plugin code was an example IIRC put together quickly in order to answer a question on a mailing-list a long time ago. The heuristic it's using to identify the subset of accounts that are to be checked for pending balance across linked transactions isn't great. You could change the code to use metadata on the Open directory to identify which accounts whose linked transactions should be checked in that way instead of using the heuristic - which would be a more explicit and sensible approach. I think the approach could be changed. (BTW the whole thing is 27 lines of code. See https://github.com/beancount/beancount/blob/v2/beancount/plugins/tag_pending.py#L53 )
On Sat, Feb 19, 2022 at 7:53 PM John Rakestraw <[email protected]> wrote: > On 2022-02-19 Sat, Martin Blais wrote: > > Can you share a minimal example input that will trigger this case? > > Thank you, > > > > Sure. > > Assume this ledger: > > ;;=== > plugin "beancount.plugins.tag_pending" > > 2022-01-01 open Assets:Reimbursable > 2022-01-01 open Liabilities:CredCard1 > 2022-01-01 open Liabilities:CredCard2 > > 2022-02-19 txn "A reimbursable expense" "" ^2022feb > Assets:Reimbursable > 50.00 USD > Liabilities:CredCard1 > > 2022-02-19 txn "Another reimbursable expense" "" ^2022feb > Assets:Reimbursable > 35.00 USD > Liabilities:CredCard1 > > ;; 2022-02-19 txn "Another reimbursable expense" "charged to different > card" ^2022feb > ;; Assets:Reimbursable > 30.00 USD > ;; Liabilities:CredCard2 > ;;=== > > > And run this query: > > bean-query ledger.beancount "SELECT date,description,position WHERE > account ~ 'reimbursable' and 'PENDING' IN tags" > > If you run it with the third transaction (charged to a different credit > card) commented, then the report is empty. If you run it with the third > transaction uncommented, then the report has the appropriate response. > > I know that folks are focussed on beancount 3 these days and that you > might not want to spend time on this, so I should say that shortly after > sending my previous message I realized that I can make this work by > including an entry like the following each month: > > 2022-02-01 txn "Placeholder entry" "" ^2022feb > Assets:Reimbursable > 0.00 USD > Liabilities:CredCard3 > > (It doesn't matter which credit card I use here, as long as it's > different from the one used in the other transactions.) > > Hope this clarifies. > > John > > > > > > On Fri, Feb 4, 2022 at 2:43 PM [email protected] < > > [email protected]> wrote: > > > >> I find the tags_pending plugin very helpful. It's generally quite > reliable > >> but there have been several instances in which liknked transactions were > >> not appropriately tagged as PENDING. > >> > >> I now believe this occurs when it happens that every transaction linked > >> with the same link includes the same two posting accounts. In such > cases, > >> the postings will always sum to zero. I see in the code comments that a > >> single transaction with the link is always marked as PENDING, and I > assume > >> this is to make sure the initial entry in the series is marked as > pending > >> even though it totals to zero. > >> > >> I'm not a programmer . Does this diagnosis make sense? And is there a > way > >> to make the plugin work in this corner case? > >> > >> Thanks. > >> > >> -- > >> 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 view this discussion on the web visit > >> > https://groups.google.com/d/msgid/beancount/d1d8b6bf-3ba3-49ed-8ced-2ff3f657ffc1n%40googlegroups.com > >> < > https://groups.google.com/d/msgid/beancount/d1d8b6bf-3ba3-49ed-8ced-2ff3f657ffc1n%40googlegroups.com?utm_medium=email&utm_source=footer > > > >> . > >> > > > > -- > > You received this message because you are subscribed to a topic in the > Google Groups "Beancount" group. > > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/beancount/dQ3pwhdPBBc/unsubscribe. > > To unsubscribe from this group and all its topics, send an email to > [email protected]. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/beancount/CAK21%2BhOv%2BRE6mqWyyZ%3DFYevyp28fghqrzd-1jQbtaGhpta14Pw%40mail.gmail.com > . > -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CAK21%2BhM80SwJft%3DmLcEqYmjw1VeT%3DokbJHN8wMp9j8HB7JVz5Q%40mail.gmail.com.
