Hello, resurrecting this thread because I think I'm facing a similar issue 
and found this thread when searching.
I use commodities to track inventory of building supplies. So far it's 
worked ok, though I've had several hiccups to overcome.
The latest is in closing the books for the previous year. I want to retain 
the inventory across the transition. My problem is that out of the equity 
command comes a posting for each commodity I have. Previously, I had 
managed to suppress this except when desired, but in the new year I have 
all hundred-plus  commodities as postings in the Opening Balance 
transaction.

I  must admit I've gotten my system to work more through trial and error 
than through a deep understanding of commodities in Ledger. What worked for 
me up till now was:

* using x COMMODITY @ UNIT-PRICE.
* always appending `--market` to my ledger command, except when I 
specifically want to see my materials inventory
* always explicitly including the Euro equivalent in the opposite posting. 
For example, when I 'use' 100 screws, if I don't put the Euro equivalent in 
the target account posting, I get screws back as a unit from then on.

I tried the `--lots` option as mentioned above. However, this doesn't seem 
to have any effect.
I'm at a bit of a loss here. It might help to compare an example 
transaction as it brought in some of these commodities originally:

```
2021-06-01 * Purchase supplies
    Assets:Bank        -€ 550
    Assets:Inventory    5000 "screws4x40_pc" @ €0,01
    Assets:Inventory    100 "DougFir2x4_m1" @€5,00
```
But `equity` at the end of the year produces:

```
2021-12-31 * Opening Balances
    Assets:Inventory           5000 "Screws4x40_pc"
    Assets:Inventory           100 "DougFir2x4_m1"
    Equity:Opening Balances    5000 "Screws4x40_pc"
    Equity:Opening Balances    100 "DougFir2x4_m1"
```

Using `--lots` adds the `{€0,01}` syntax.
I don't understand whether the different syntax (@ vs {}) is causing this, 
or something else. 
I'm currently in the process of trying to remove all those commodities from 
Opening Balances and replace them with a single posting in Euros, but I'm 
afraid I can't post my results yet here because I'm being blocked by 
parsing errors which I don't understand yet. Also, this approach seems like 
too much work to do every year even if it will work in the end.

So I'm wondering if there's some way to tease out an Opening Balance 
statement that will let me keep seeing Euros in reports in the new year? 
Or, if someone can explain where I'm misunderstanding the use of 
commodities that's causing my troubles?

Thanks,
Hans

On Sunday, 10 May 2020 at 08:49:45 UTC+2 [email protected] wrote:

> >>>>> "J" == Joel <[email protected]> writes:
>
> J> Is there a way to do this that carries cost basis forward for 
> transactions
> J> with commodities or currencies where one wants to track the cost basis? 
> Or
> J> must I manually run a report with the lot information and then add that 
> to
> J> the opening balances statement?
>
> Try using the `--lots` option when generating the equity report. Cost 
> basis is
> tracked as the lot price. It is likely to also generate a lot more
> transactions, one for each distinct lot.
>
> John
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" 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/ledger-cli/f3792c74-24a5-481a-95b7-a6170d725922n%40googlegroups.com.

Reply via email to