xuhcc / beancount-mobile

Data entry app for Beancount plain-text accounting system
GNU General Public License v3.0
114 stars 10 forks source link

swap accountFrom and accountTo, allow for negative amounts #9

Closed palmista closed 4 years ago

palmista commented 4 years ago

First of all thank you for developing this useful app!

Problem: The accountFrom part of the transaction is written above the accountTo part. This contradicts standard accounting conventions from my area where the receiving account is always stated before the diminished account.

I know in English speaking areas the conventions are slightly different, stating the debit account before the credit account. But again, that contradicts the order you chose because at least for basic transactions, the debit account is the one with the positive entry and the credit account the one with the negative one.

Possible solution(s):

  1. Swap the accountFrom and accountTo elements both in the "new transaction" form and in the actual transaction in the beancount file.
  2. More importantly: Allow for negative amounts in the "new transaction" form. This will give more flexibility and also for a workaround if or as long as point 1. isn't implemented.

Thanks for your consideration!

xuhcc commented 4 years ago

Hello @palmista !

Swap the accountFrom and accountTo elements both in the "new transaction" form and in the actual transaction in the beancount file.

I can add a setting that would allow to change the order of these fields. It shouldn't be very difficult.

xuhcc commented 4 years ago

New version of Beancount Mobile app (v1.5.0) has been released.

Now you can add this custom directive to your beancount file:

1970-01-01 custom "bcm_option" "account_order" "to_from"
palmista commented 4 years ago

Somehow, that isn't working for me. Setting an operating currency in the file is, the custom options (transaction_flags, account_order) isn't.

This is the content of my test file:

* Options
option "operating_currency" "CHF"

1970-01-01 custom "bcm_option" "transaction_flags" "['!']"

1970-01-01 custom "bcm_option" "account_order" "to_from"

* Accounts
2020-04-01 open Assets:Bank
2020-04-01 open Expenses:Food

* Transactions

2020-06-05 * "Test"
    Assets:Bank  -5 CHF
    Expenses:Food  5 CHF

Did I do anything wrong?

xuhcc commented 4 years ago

Make sure you have the latest version (1.5.0). I just tried to add transaction to your file and it works as expected:

Screenshot_1591367365

palmista commented 4 years ago

That's weird!

I do have 1.5.0, and reinstalling the app from aurora store or directly from your repository didn't help.

Edit: I tried it without success on two different phones, one with Android 7.1.2 (Samsung Galaxy S7 with /e/), the other with Android 4.4.4 (Samsung J-100 with stock ROM).

xuhcc commented 4 years ago

Maybe your beancount file is different from what you posted above?

palmista commented 4 years ago

No, it's not. I even copy-pasted the whole text back into a file to make sure. Whatever I try, I can't make it work. What environment have you tested it in?

xuhcc commented 4 years ago

Android 6, 9.

palmista commented 4 years ago

Tried on a third phone with android 8.0.0 - not working. Just to be sure: Here is one of the files I was testing with:

test(3) (2).txt

xuhcc commented 4 years ago

In the lines where custom options are defined you are using non-breakable spaces (https://www.compart.com/en/unicode/U+00A0) instead of regular spaces (https://www.compart.com/en/unicode/U+0020), so the parser can't read these lines.

palmista commented 4 years ago

Thanks, that solved the issue. I ended up with them because I had copied the code lines from the GitHub Android app. Will certainly avoid doing that in the future. Thanks for your patience, and thanks for implementing this feature!