Browse Source

Use the account of the parent transaction of sub transaction

* elbank-common.el (elbank-transaction-elt): Because split transactions have no
  account, use their parent transaction.
custom-labels
Nicolas Petton 3 years ago
parent
commit
b691241c43
No known key found for this signature in database GPG Key ID: E8BCD7866AFCF978
1 changed files with 8 additions and 0 deletions
  1. +8
    -0
      elbank-common.el

+ 8
- 0
elbank-common.el View File

@ -134,6 +134,14 @@ the value at symbol `raw' if not. If both are nil, return DEFAULT."
(or (map-elt transaction 'label nil)
(map-elt transaction 'raw default)))
(cl-defmethod elbank-transaction-elt (transaction (key (eql account)) &optional default)
"Return the account of TRANSACTION.
If TRANSACTION is a split transaction, return the account of its parent transaction."
(if (elbank-sub-transaction-p transaction)
(elbank-transaction-elt (elbank-transaction-elt transaction 'split-from) 'account)
(cl-call-next-method transaction key default)))
(cl-defmethod elbank-transaction-elt (transaction (_key (eql category)) &optional default)
"Return the category of TRANSACTION.


Loading…
Cancel
Save