Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-suggest account-appropriate commodity balance rather than balance of all commodities #65

Open
the-solipsist opened this issue Dec 19, 2021 · 3 comments

Comments

@the-solipsist
Copy link

I structure my accounts such that different sub-accounts contain only a single commodity. So, for instance, Assets:Cash:INR and Assets:Cash:USD, and so on.

When I have a transaction with postings having multiple commodities (for instance, if I have a single transaction involving purchases in both INR and USD, the auto-suggested default amounts (i.e., the amounts if I simply press "Enter"/"Return") would be applied to a single account, whereas I would usually have two separate accounts to which they ought to be applied (i.e., Assets:Cash:INR and Assets:Cash:USD, rather then both the INR and USD balances from a single account).

If hledger-iadd could be smarter about which commodity to apply to which account (e.g., by checking if past transactions to that account only involve a single commodity), that would be very helpful. Currently, I have to manually enter the commodity and the amount instead of using the default auto-suggestions.

@the-solipsist the-solipsist changed the title [Enhancement] Auto-suggest correct commodity balance rather than balance of all commodities [Enhancement] Auto-suggest account-appropriate commodity balance rather than balance of all commodities Dec 19, 2021
@the-solipsist
Copy link
Author

As an example:
Screenshot from 2021-12-22 22-33-26
Screenshot from 2021-12-22 22-35-10

In this example, I would want hledger-iadd to fill only the USD figure in Equity:Trading:Currency:INR-USD:USD, since that sub-account only ever has USD amounts, and then auto-suggest ₹-750.00 for a different 4th account.

@hpdeifel
Copy link
Owner

Hm, I wonder if this is common practice or if the behaviour that you suggest use would then in turn confuse other users that want to have both currencies suggested. Otherwise, it sounds reasonable to do.

@hpdeifel hpdeifel changed the title [Enhancement] Auto-suggest account-appropriate commodity balance rather than balance of all commodities Auto-suggest account-appropriate commodity balance rather than balance of all commodities Dec 22, 2021
@the-solipsist
Copy link
Author

If a sub-account has a history of holding multiple currencies, then there's no issue at all. Those who would want both suggested would probably have a sub-account with multiple currencies (or zero currencies). But for those sub-accounts with only one currency, pressing "enter" once should use the appropriate one of the two/more currencies.

So if there's a fast programmatic way of determining if a sub-account has only one or multiple currencies, then that should be used. Or else, checking which currency was used the previous time with that sub-account.

Frankly, I would prefer that latter approach: automatically using the currency that was last associated with the sub-account.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants