hpdeifel / hledger-iadd

A terminal UI as drop-in replacement for hledger add.
BSD 3-Clause "New" or "Revised" License
77 stars 8 forks source link

Can't add transaction with commodity #45

Closed edkedk99 closed 4 years ago

edkedk99 commented 4 years ago

For posterity: The following was originally posted by @edkedk99 and I accidentally converted it into my own comment

Error description

When you try to add transaction with only 2 posting and one of them is priced using a commodity, hledger-iadd doesn't allow you to save it, but tries to force you to add more 2 postings. Sometimes it says the transaction is not balanced.

Reproduce error

Add the following transaction using hledger-iadd

2020/01/22 Apple Stock
Assets:Savings             100 AAPL @ 300
Assets:Checking          -30000

Why it is an error

If you add the above transaction on a journal file, hledger accept it, so hledger-iadd should accept too. Also, there is no error when you add this transaction using hledger add

hpdeifel commented 4 years ago

Ok, apparently "create pull-request from issue" is the wrong button to press in magit...

Anyway, @edkedk99: Please check if this fixes your issue

edkedk99 commented 4 years ago

@hpdeifel ,

EDIT: Sorry, I now understood the process. I compiled and now the error is not happening. Thank you very much for your help and support. Problem solved! Please discard the message below

Thank for your support. The error keeps happening to me, but there is a high chance that I am not able to compile the correct version since I don't know Haskell.

I merged a local branch with the commit you mentioned, deleted the previous hledger-iadd and run stack build; stack install. Then I removed the binary and tried ``stack run```.

I am not sure if I am installing the latest official version or the one in this commit. Could you tell me if I am doing right? If not, maybe suggest an article that explain how can I do it.

hpdeifel commented 4 years ago

EDIT: Sorry, I now understood the process. I compiled and now the error is not happening. Thank you very much for your help and support. Problem solved! Please discard the message below

Great!

Do you have any suggestion on how the README can be improved? Maybe it's not clear enough.

edkedk99 commented 4 years ago

I think the documentation should suggest to try to install again using stack install with the option --force-dirty. For me that solved the issue.

Thank you again

hpdeifel commented 4 years ago

Hmm, I'm a bit hesitant to add this to the README, since it shouldn't really be necessary (except for bugs in stack itself). I've never needed to use this option myself.

edkedk99 commented 4 years ago

You may be right. I came to this in trial and error.