Hi there,
I am encountering an issue with trying to create commodity equivalences and filter my transactions by certain commodities. My use case is tracking inventory, where I have certain items as commodities, and want to convert groups of commodities to a single category. Here is an example:
; -*- mode: ledger; -*-
commodity Apple
commodity Orange
commodity Fruit
C 1 Apple = 1 Fruit
C 1 Orange = 1 Fruit
2019/10/19 Foo
A 3 Apple
A 3 Orange
B
The register command outputs the following:
] reg
19-Oct-19 Foo A 3 Orange 3 Orange
A 3 Orange 6 Orange
B -6 Orange 0
I would expect the first transaction in the posting to show "3 Apple" instead. "reg -V" produces the same output, which is odd since I would expect the primary commodity of each transaction to be Apple or Orange.
] reg -V
19-Oct-19 Foo A 3 Orange 3 Orange
A 3 Orange 6 Orange
B -6 Orange 0
Furthermore, when I try to use "-X" to convert to a commodity, say Fruit, that does nothing either:
] reg -X Fruit
19-Oct-19 Foo A 3 Orange 3 Orange
A 3 Orange 6 Orange
B -6 Orange 0
Lastly, when I try to use "-l" to limit by commodity, the whole transaction is filtered, and nothing is returned.
] reg -l "commodity == 'Apple'"
<no output?>
Is there something fundamental I am missing about how commodity equivalences work? What is going wrong here? Thanks in advance for any help! I am attaching this example ledger file as well.
--Gautam