This should probably be a FAQ. See recent thread: https://groups.google.com/g/beancount/c/88WjwEhJKUk and many before.
In short: Booking runs before plugins <https://github.com/beancount/beancount/blob/3ec62d4d8e68f352156eec6c7068b8aee8fc65f1/beancount/loader.py#L531>. There's been discussion in the past about having pre-booking plugins, it would certainly be helpful in a case like this. On Fri, Nov 11, 2022 at 7:19 AM Peter <[email protected]> wrote: > Hi, > > I'm using the transfer_lots plugin to transfer lots between accounts. > > Sadly, after one transfer the lot seems to be locked. I.e., the `failed to > categorize posting` error occurs. > See this MWE: > > option "booking_method" "FIFO" > option "operating_currency" "USD" > plugin "beancount.plugins.auto_accounts" > > option "insert_pythonpath" "True" > plugin "Plugins.transfer_lots" "transfer" > plugin "beancount.plugins.implicit_prices" > > 2021-01-08 * "" "Buy LOT" > Assets:Broker:LOT 1.25 LOT { 600 USD } > Equity:Opening-Account > > 2021-01-10 * "" "Transfer LOT" #transfer > Assets:Broker:LOT -1.25 LOT {} > Assets:Storage:LOT > > > 2021-03-11 * "Buy more LOT" > Assets:Broker:LOT 0.25 LOT { 800 USD } > Equity:Opening-Account > > 2021-03-12 * "Transfer LOT" #transfer ; failed to categorize posting > Assets:Storage:LOT -1.25 LOT {} > Assets:Storage2:LOT > > 2021-04-10 * "Transfer LOT" #transfer > Assets:Broker:LOT -0.25 LOT {} > Assets:Storage2:LOT > > 2021-04-10 * "Transfer LOT" #transfer ; failed to categorize posting > Assets:Storage2:LOT -0.25 LOT {} > Assets:Storage:LOT > > Why is that and what can I do here, to make this work? > > Editing the last txn to: (inspired by github issue 541) > <https://github.com/beancount/beancount/issues/541> > > 2021-04-10 * "Transfer LOT" #transfer ; failed to categorize posting > Assets:Storage2:LOT -0.25 LOT {USD} > Assets:Storage:LOT 0 > > Doesn't work, either: > > ** Balances before transaction -------------------------------- > > Assets:Storage2:LOT 0.25 LOT {800 USD, 2021-03-11} > > Assets:Storage:LOT 1.25 LOT {600 USD, 2021-01-08} > > > ** Unbooked Transaction -------------------------------- > > 2021-04-10 * "Transfer LOT" #transfer > Assets:Storage2:LOT -0.25 LOT {} ; > > Assets:Storage:LOT 0 <class 'beancount.core.number.MISSING'> ; 0 > <class 'beancount.core.number.MISSING'> > > > ** Transaction -------------------------------- > > 2021-04-10 * "Transfer LOT" #transfer > Assets:Storage2:LOT -0.25 LOT {-0 USD, 2021-04-10} ; 0 USD > Assets:Storage:LOT 0.25 LOT {-0 USD, 2021-04-10} ; -0 USD > > > ** Residual and Tolerances -------------------------------- > > > > ** Balances after transaction -------------------------------- > > Assets:Storage2:LOT 0.25 LOT {800 USD, 2021-03-11} > * Assets:Storage2:LOT -0.25 LOT {-0 USD, 2021-04-10} > > Assets:Storage:LOT 1.25 LOT {600 USD, 2021-01-08} > * Assets:Storage:LOT 0.25 LOT {-0 USD, 2021-04-10} > > Any help/input is greatly appreciated. How can I "unlock" the lots and > transfer them more than once? > > Regards > > -- > 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/5785792c-695a-4c5c-94d2-3adcc090aed7n%40googlegroups.com > <https://groups.google.com/d/msgid/beancount/5785792c-695a-4c5c-94d2-3adcc090aed7n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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/CACGEkZvT%2BDLmwdJ6n4KLSeN_gFgVAjk1A%3Dg86%3D%3DJ2fHViBbL5A%40mail.gmail.com.
