Bug 1204 - --empty option does not work
Summary: --empty option does not work
Alias: None
Product: Ledger
Classification: Unclassified
Component: report (show other bugs)
Version: 3.1.1
Hardware: PC Linux
: P5 normal
Assignee: John Wiegley
Depends on:
Reported: 2017-03-16 16:44 UTC by Owen Heisler
Modified: 2017-03-26 01:06 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Owen Heisler 2017-03-16 16:44:17 UTC
The `--empty` option has no effect on the output of the `balance` command. I expect the `--empty` option to cause the `balance` report to display all accounts that have been declared with the `account` command, even if they are zero balance or are parent accounts.

Here is an example journal.

account Assets
account Expenses
account Expenses:Clothing
account Expenses:Food
account Income

2017-03-15 Employer
    Income             $-100
    Assets              $100

2017-03-15 Restaurant
    Assets              $-20
    Expenses:Food        $20

Ledger shows the same balance report with or without `--empty`:

$ ledger --no-total --empty balance
                 $80  Assets
                 $20  Expenses:Food
               $-100  Income

$ ledger --version | head -n1
Ledger 3.1.1-20160111, the command-line accounting tool

This is the expected output:

$ ledger --no-total --empty balance # EXAMPLE
                 $80  Assets
                 $20  Expenses
                   0    Clothing
                 $20    Food
               $-100  Income

Thank you!
Comment 1 Owen Heisler 2017-03-26 01:06:42 UTC
See the discussion on the mailing list also:


The conclusion there, as I understand it, is this: if the `--empty` option is used, then a dummy transaction should be injected for each account specified by the `account` directive. It would need to have an amount of integer 0, and would not need any matching account (with a zero amount, it would already be balanced).

Here are the relevant quotes:

John Wiegley wrote at 2017-03-17 17:26 -0500:
>So maybe what we need to do is inject some dummy "Starting balance"
>transactions, that simply draw from Equity:Opening Balances in the amount
>of integer 0.


John Wiegley wrote at 2017-03-17 22:37 -0500:
>Actually, since the dummy transaction is a posting in the amount of zero, I
>suppose it doesn't need to balance with anything else.