From: Christian Heller Date: Thu, 20 Mar 2025 02:43:01 +0000 (+0100) Subject: Fix balance showing not-yet-used accounts. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/booking/static/%7B%7Bdb.prefix%7D%7D/tasks?a=commitdiff_plain;h=refs%2Fheads%2Fmaster;p=ledgplom Fix balance showing not-yet-used accounts. --- diff --git a/src/templates/balance.tmpl b/src/templates/balance.tmpl index cfd46f7..35f0fae 100644 --- a/src/templates/balance.tmpl +++ b/src/templates/balance.tmpl @@ -2,41 +2,43 @@ {% macro account_with_children(booking_id, account, indent) %} - - - {% if account.get_wealth(booking_id).moneys|length == 1 %} - - {% for curr, amt in account.get_wealth(booking_id).moneys.items() %} - {{ macros.tr_money_balance(amt, curr) }} - {% endfor %} -
- {% else %} -
- - - {% for curr, amt in account.get_wealth(booking_id).moneys.items() %} - {% if 1 == loop.index %} - {{ macros.tr_money_balance(amt, curr) }} - {% endif %} - {% endfor %} -
-
- - {% for curr, amt in account.get_wealth(booking_id).moneys.items() %} - {% if 1 < loop.index %} + {% if account.get_wealth(booking_id).moneys|length > 0 %} + + + + + + {% for child in account.children %} + {{ account_with_children(booking_id, child, indent=indent+1) }} {% endfor %} -
+ {% if account.get_wealth(booking_id).moneys|length == 1 %} + + {% for curr, amt in account.get_wealth(booking_id).moneys.items() %} {{ macros.tr_money_balance(amt, curr) }} - {% endif %} + {% endfor %} +
+ {% else %} +
+ + + {% for curr, amt in account.get_wealth(booking_id).moneys.items() %} + {% if 1 == loop.index %} + {{ macros.tr_money_balance(amt, curr) }} + {% endif %} + {% endfor %} +
+
+ + {% for curr, amt in account.get_wealth(booking_id).moneys.items() %} + {% if 1 < loop.index %} + {{ macros.tr_money_balance(amt, curr) }} + {% endif %} + {% endfor %} +
+
+ {% endif %} +
{% for i in range(indent) %} {% endfor %}{% if account.parent %}:{% endif %}{{account.basename}}{% if account.children %}:{% endif %}{{account.desc}}
-
{% endif %} - - {% for i in range(indent) %} {% endfor %}{% if account.parent %}:{% endif %}{{account.basename}}{% if account.children %}:{% endif %} - {{account.desc}} - - {% for child in account.children %} - {{ account_with_children(booking_id, child, indent=indent+1) }} - {% endfor %} {% endmacro %}