Here, it's properly forbidden now, it should fail:
https://bitbucket.org/blais/beancount/commits/1e17e0e37f1cf653ede61b2a4d026115a8448d13


On Thu, Mar 22, 2018 at 7:56 PM, Martin Blais <[email protected]> wrote:

> On Wed, Mar 21, 2018 at 2:28 PM, Martin Michlmayr <[email protected]> wrote:
>
>> Let's assume you have some kind of points which can be converted to
>> USD at 0.75 cents or converted to air miles 1:1.
>>
>> If we do:
>>
>> 2010-01-01 open Assets:Test
>> 2010-01-01 open Expenses:Whatever
>>
>> 2018-03-20 * "Use MR for purchase"
>>   Expenses:Whatever                     42.30 USD
>>   Assets:Test               -5641 MR @@ 42.30 USD
>>
>> 2018-03-21 * "Convert MR to miles"
>>   Expenses:Whatever                    1 KRISFLYER
>>   Assets:Test                 -1 MR @@ 1 KRISFLYER
>>
>> everything is fine.
>>
>> However, let's be masochistic and track these MR points at a cost of
>> 0.075 cents:
>>
>> option "inferred_tolerance_default" "USD:0.01"
>>
>> 2010-01-01 open Assets:Test
>> 2010-01-01 open Equity:Opening-Balance
>> 2010-01-01 open Expenses:Whatever
>> 2010-01-01 open Assets:Krisflyer
>>
>> 2018-03-20 * "MR is treated as a commodity"
>>   Assets:Test               10000 MR {0.0075 USD}
>>   Equity:Opening-Balance
>>
>> 2018-03-20 * "Use MR for purchase"
>>   Assets:Test                  -5641 MR {0.0075 USD}
>>   Expenses:Whatever                      42.31 USD
>>
>> 2018-03-21 * "Convert MR to KrisFlyer"
>>   Assets:Test                -100 MR {0.0075 USD} @ 1 KRISFLYER
>>
>
> This should have failed.
> I'm pretty darn sure I added a test to prevent this in the past, but I'm
> stunned now that this passes, and I can't find the test!
> That this doesn't output an error message, is a bug.
> I'll make this fail now, you're not supposed to be allowed to use a
> different price currency than the cost currency you're using.
>
> In any case, when you use the cost, the price is ignored (other than to be
> added to the prices database).
> The "weight" of that posting against the rest is that which is used and it
> is inferred by the cost only.
>
>
>
>>   Assets:Krisflyer
>>
>> Now:
>>
>> bean-report d5 balances -e Assets:Krisflyer
>> Assets:Krisflyer        0.7500 USD
>>
>> Why is this USD and not 100 KRISFYLER?
>
>
> Because the price is ignored (desired).
>
>
>
>> Is there any way to convert
>> something with cost USD to some other commodity or do you always have
>> to convert to the cost commodity (i.e. USD here)?
>>
>
> You can make the other posting priced in USD (not supported in Ledger BTW,
> if I recall correctly).
>
>
> It sort of makes sense because how else can the gain be calculated?
>>
>
> Yep.
>
>
>
>> But ledger happily creates 100 KRISFYLER in the example above and
>> somehow this ought to be possible but I don't know how.
>>
>
> This works:
>
> 2018-03-21 * "Convert MR to KrisFlyer"
>   Assets:Test                -100 MR {0.0075 USD}
>   Assets:Krisflyer           100 KRISFLYER @ 0.007500 USD
>
>
> This too:
>
> 2018-03-21 * "Convert MR to KrisFlyer"
>   Assets:Test                -100 MR {0.0075 USD}
>   Assets:Krisflyer           100 KRISFLYER @ USD
>
>
>
>
> Maybe my transactions are not right because of my ledger-mindset
>> (i.e. I'm confusing costs and prices all the time) but how would
>> I do this?
>>
>
> I'd be more confused if I had two different syntaxes which do the same
> thing if you ask me...
>
> - prices are used for price conversions (e.g., currencies)
> - costs are used only when you need to track the cost basis (e.g.,
> investments)
>
> That's it.
>
>

-- 
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%2BhMvD-JjnrR-wjczHa3PJubp2BNnNmkchddstzkPruXqXA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to