Open the-solipsist opened 2 years ago
As an example:
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.
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.
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.
I structure my accounts such that different sub-accounts contain only a single commodity. So, for instance,
Assets:Cash:INR
andAssets: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
andUSD
, 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
andAssets:Cash:USD
, rather then both theINR
andUSD
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.