Added the mount, debit_amount, and credit_amount properties to replace the run-time balance, total, debit, and credit properties in the Account data model in the accounting application.
This commit is contained in:
parent
bcc394128e
commit
b652d090d3
@ -58,6 +58,9 @@ class Account(DirtyFieldsMixin, models.Model):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(Account, self).__init__(*args, **kwargs)
|
||||
self.url = None
|
||||
self.debit_amount = None
|
||||
self.credit_amount = None
|
||||
self.amount = None
|
||||
|
||||
def __str__(self):
|
||||
"""Returns the string representation of this account."""
|
||||
|
@ -95,7 +95,7 @@ First written: 2020/7/20
|
||||
{% for item in group.details %}
|
||||
<tr>
|
||||
<td><div class="account">{{ item.title|title }}</div></td>
|
||||
<td class="amount {% if item.balance < 0 %} text-danger {% endif %}">{{ item.balance|accounting_amount }}</td>
|
||||
<td class="amount {% if item.amount < 0 %} text-danger {% endif %}">{{ item.amount|accounting_amount }}</td>
|
||||
<td class="actions">
|
||||
<a href="{{ item.url }}" class="btn btn-info" role="button">
|
||||
<i class="fas fa-eye"></i>
|
||||
@ -126,7 +126,7 @@ First written: 2020/7/20
|
||||
{% for item in group.details %}
|
||||
<tr>
|
||||
<td><div class="account">{{ item.title|title }}</div></td>
|
||||
<td class="amount {% if item.balance < 0 %} text-danger {% endif %}">{{ item.balance|accounting_amount }}</td>
|
||||
<td class="amount {% if item.amount < 0 %} text-danger {% endif %}">{{ item.amount|accounting_amount }}</td>
|
||||
<td class="actions">
|
||||
<a href="{{ item.url }}" class="btn btn-info" role="button">
|
||||
<i class="fas fa-eye"></i>
|
||||
@ -140,8 +140,8 @@ First written: 2020/7/20
|
||||
<tfoot>
|
||||
<tr class="total">
|
||||
<td>{% trans "Total" context "Accounting|" as text %}{{ text|force_escape }}</td>
|
||||
<td class="amount {% if liabilities.balance < 0 %} text-danger {% endif %}">
|
||||
{{ liabilities.balance|accounting_amount }}
|
||||
<td class="amount {% if liabilities.amount < 0 %} text-danger {% endif %}">
|
||||
{{ liabilities.amount|accounting_amount }}
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
@ -163,7 +163,7 @@ First written: 2020/7/20
|
||||
{% for item in group.details %}
|
||||
<tr>
|
||||
<td><div class="account">{{ item.title|title }}</div></td>
|
||||
<td class="amount {% if item.balance < 0 %} text-danger {% endif %}">{{ item.balance|accounting_amount }}</td>
|
||||
<td class="amount {% if item.amount < 0 %} text-danger {% endif %}">{{ item.amount|accounting_amount }}</td>
|
||||
<td class="actions">
|
||||
<a href="{{ item.url }}" class="btn btn-info" role="button">
|
||||
<i class="fas fa-eye"></i>
|
||||
@ -177,8 +177,8 @@ First written: 2020/7/20
|
||||
<tfoot>
|
||||
<tr class="total">
|
||||
<td>{% trans "Total" context "Accounting|" as text %}{{ text|force_escape }}</td>
|
||||
<td class="amount {% if owners_equity.balance < 0 %} text-danger {% endif %}">
|
||||
{{ owners_equity.balance|accounting_amount }}
|
||||
<td class="amount {% if owners_equity.amount < 0 %} text-danger {% endif %}">
|
||||
{{ owners_equity.amount|accounting_amount }}
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
@ -192,8 +192,8 @@ First written: 2020/7/20
|
||||
<tfoot>
|
||||
<tr class="total">
|
||||
<td class="align-middle">{% trans "Total" context "Accounting|" as text %}{{ text|force_escape }}</td>
|
||||
<td class="text-right align-middle font-italic {% if assets.balance < 0 %} text-danger {% endif %}">
|
||||
{{ assets.balance|accounting_amount }}
|
||||
<td class="text-right align-middle font-italic {% if assets.amount < 0 %} text-danger {% endif %}">
|
||||
{{ assets.amount|accounting_amount }}
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
@ -205,8 +205,8 @@ First written: 2020/7/20
|
||||
<tfoot>
|
||||
<tr class="total">
|
||||
<td class="align-middle">{% trans "Total" context "Accounting|" as text %}{{ text|force_escape }}</td>
|
||||
<td class="text-right align-middle font-italic {% if liabilities.balance|add:owners_equity.balance < 0 %} text-danger {% endif %}">
|
||||
{{ liabilities.balance|add:owners_equity.balance|accounting_amount }}
|
||||
<td class="text-right align-middle font-italic {% if liabilities.amount|add:owners_equity.amount < 0 %} text-danger {% endif %}">
|
||||
{{ liabilities.amount|add:owners_equity.amount|accounting_amount }}
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
@ -236,8 +236,8 @@ First written: 2020/7/20
|
||||
<a class="list-group-item-action" href="{{ item.url }}">
|
||||
{{ item.title|title }}
|
||||
<div class="float-right">
|
||||
<span class="badge {% if item.balance < 0 %} badge-warning {% else %} badge-secondary {% endif %} badge-pill">
|
||||
{{ item.balance|accounting_amount }}
|
||||
<span class="badge {% if item.amount < 0 %} badge-warning {% else %} badge-secondary {% endif %} badge-pill">
|
||||
{{ item.amount|accounting_amount }}
|
||||
</span>
|
||||
</div>
|
||||
</a>
|
||||
@ -246,8 +246,8 @@ First written: 2020/7/20
|
||||
{% endfor %}
|
||||
<li class="list-group-item d-flex justify-content-between align-items-center grand-total">
|
||||
{% trans "Total" context "Accounting|" as text %}{{ text|force_escape }}
|
||||
<span class="badge {% if assets.balance < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill">
|
||||
{{ assets.balance|accounting_amount }}
|
||||
<span class="badge {% if assets.amount < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill">
|
||||
{{ assets.amount|accounting_amount }}
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
@ -267,8 +267,8 @@ First written: 2020/7/20
|
||||
<a class="list-group-item-action" href="{{ item.url }}">
|
||||
{{ item.title|title }}
|
||||
<div class="float-right">
|
||||
<span class="badge {% if item.balance < 0 %} badge-warning {% else %} badge-secondary {% endif %} badge-pill">
|
||||
{{ item.balance|accounting_amount }}
|
||||
<span class="badge {% if item.amount < 0 %} badge-warning {% else %} badge-secondary {% endif %} badge-pill">
|
||||
{{ item.amount|accounting_amount }}
|
||||
</span>
|
||||
</div>
|
||||
</a>
|
||||
@ -277,8 +277,8 @@ First written: 2020/7/20
|
||||
{% endfor %}
|
||||
<li class="list-group-item d-flex justify-content-between align-items-center total">
|
||||
{% trans "Total" context "Accounting|" as text %}{{ text|force_escape }}
|
||||
<span class="badge {% if liabilities.balance < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill">
|
||||
{{ liabilities.balance|accounting_amount }}
|
||||
<span class="badge {% if liabilities.amount < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill">
|
||||
{{ liabilities.amount|accounting_amount }}
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
@ -297,8 +297,8 @@ First written: 2020/7/20
|
||||
<a class="list-group-item-action" href="{{ item.url }}">
|
||||
{{ item.title|title }}
|
||||
<div class="float-right">
|
||||
<span class="badge {% if item.balance < 0 %} badge-warning {% else %} badge-secondary {% endif %} badge-pill">
|
||||
{{ item.balance|accounting_amount }}
|
||||
<span class="badge {% if item.amount < 0 %} badge-warning {% else %} badge-secondary {% endif %} badge-pill">
|
||||
{{ item.amount|accounting_amount }}
|
||||
</span>
|
||||
</div>
|
||||
</a>
|
||||
@ -307,8 +307,8 @@ First written: 2020/7/20
|
||||
{% endfor %}
|
||||
<li class="list-group-item d-flex justify-content-between align-items-center total">
|
||||
{% trans "Total" context "Accounting|" as text %}{{ text|force_escape }}
|
||||
<span class="badge {% if owners_equity.balance < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill">
|
||||
{{ owners_equity.balance|accounting_amount }}
|
||||
<span class="badge {% if owners_equity.amount < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill">
|
||||
{{ owners_equity.amount|accounting_amount }}
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
@ -316,8 +316,8 @@ First written: 2020/7/20
|
||||
<ul class="list-group balance-sheet-list">
|
||||
<li class="list-group-item d-flex justify-content-between align-items-center grand-total">
|
||||
{% trans "Total" context "Accounting|" as text %}{{ text|force_escape }}
|
||||
<span class="badge {% if liabilities.balance|add:owners_equity.balance < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill">
|
||||
{{ liabilities.balance|add:owners_equity.balance|accounting_amount }}
|
||||
<span class="badge {% if liabilities.amount|add:owners_equity.amount < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill">
|
||||
{{ liabilities.amount|add:owners_equity.amount|accounting_amount }}
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -106,7 +106,7 @@ First written: 2020/7/19
|
||||
{% for item in group.details %}
|
||||
<tr>
|
||||
<td><div class="account">{{ item.title|title }}</div></td>
|
||||
<td class="amount {% if item.balance < 0 %} text-danger {% endif %}">{{ item.balance|accounting_amount }}</td>
|
||||
<td class="amount {% if item.amount < 0 %} text-danger {% endif %}">{{ item.amount|accounting_amount }}</td>
|
||||
<td class="amount"></td>
|
||||
<td class="actions">
|
||||
<a href="{% url "accounting:ledger" item period %}" class="btn btn-info" role="button">
|
||||
@ -119,7 +119,7 @@ First written: 2020/7/19
|
||||
<tr class="total">
|
||||
<td><div>{% trans "Total" context "Accounting|" as text %}{{ text|force_escape }}</div></td>
|
||||
<td class="amount"></td>
|
||||
<td class="amount {% if group.total < 0 %} text-danger {% endif %}">{{ group.total|accounting_amount }}</td>
|
||||
<td class="amount {% if group.amount < 0 %} text-danger {% endif %}">{{ group.amount|accounting_amount }}</td>
|
||||
<td class="actions"></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
@ -135,7 +135,7 @@ First written: 2020/7/19
|
||||
<tr class="cumulative-total">
|
||||
<td><div>{{ section.cumulative_total.title|title }}</div></td>
|
||||
<td class="amount"></td>
|
||||
<td class="amount {% if section.cumulative_total.total < 0 %} text-danger {% endif %}">{{ section.cumulative_total.total|accounting_amount }}</td>
|
||||
<td class="amount {% if section.cumulative_total.amount < 0 %} text-danger {% endif %}">{{ section.cumulative_total.amount|accounting_amount }}</td>
|
||||
<td class="actions"></td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
@ -172,8 +172,8 @@ First written: 2020/7/19
|
||||
<a class="list-group-item-action" href="{% url "accounting:ledger" item period %}">
|
||||
{{ item.title|title }}
|
||||
<div class="float-right">
|
||||
<span class="badge {% if item.balance < 0 %} badge-warning {% else %} badge-secondary {% endif %} badge-pill">
|
||||
{{ item.balance|accounting_amount }}
|
||||
<span class="badge {% if item.amount < 0 %} badge-warning {% else %} badge-secondary {% endif %} badge-pill">
|
||||
{{ item.amount|accounting_amount }}
|
||||
</span>
|
||||
</div>
|
||||
</a>
|
||||
@ -182,8 +182,8 @@ First written: 2020/7/19
|
||||
<li class="list-group-item d-flex justify-content-between align-items-center total">
|
||||
{% trans "Total" context "Accounting|" as text %}{{ text|force_escape }}
|
||||
<div class="float-right">
|
||||
<span class="badge {% if group.total < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill">
|
||||
{{ group.total|accounting_amount }}
|
||||
<span class="badge {% if group.amount < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill">
|
||||
{{ group.amount|accounting_amount }}
|
||||
</span>
|
||||
</div>
|
||||
</li>
|
||||
@ -192,7 +192,7 @@ First written: 2020/7/19
|
||||
<li class="list-group-item d-flex justify-content-between align-items-center total">
|
||||
{% trans "Total" context "Accounting|" as text %}{{ text|force_escape }}
|
||||
<div class="float-right">
|
||||
<span class="badge {% if group.total < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill">-</span>
|
||||
<span class="badge {% if group.amount < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill">-</span>
|
||||
</div>
|
||||
</li>
|
||||
{% endif %}
|
||||
@ -200,8 +200,8 @@ First written: 2020/7/19
|
||||
<li class="list-group-item d-flex justify-content-between align-items-center cumulative-total">
|
||||
{{ section.cumulative_total.title|title }}
|
||||
<div class="float-right">
|
||||
<span class="badge {% if section.cumulative_total.total < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill">
|
||||
{{ section.cumulative_total.total|accounting_amount }}
|
||||
<span class="badge {% if section.cumulative_total.amount < 0 %} badge-danger {% else %} badge-info {% endif %} badge-pill">
|
||||
{{ section.cumulative_total.amount|accounting_amount }}
|
||||
</span>
|
||||
</div>
|
||||
</li>
|
||||
|
@ -95,8 +95,8 @@ First written: 2020/7/19
|
||||
{% for item in item_list %}
|
||||
<tr>
|
||||
<td>{{ item.title|title }}</td>
|
||||
<td class="amount">{{ item.debit|accounting_amount }}</td>
|
||||
<td class="amount">{{ item.credit|accounting_amount }}</td>
|
||||
<td class="amount">{{ item.debit_amount|accounting_amount }}</td>
|
||||
<td class="amount">{{ item.credit_amount|accounting_amount }}</td>
|
||||
<td class="actions">
|
||||
<a href="{% url "accounting:ledger" item period %}" class="btn btn-info" role="button">
|
||||
<i class="fas fa-eye"></i>
|
||||
@ -109,8 +109,8 @@ First written: 2020/7/19
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td>{% trans "Total" context "Accounting|" as text %}{{ text|force_escape }}</td>
|
||||
<td class="amount">{{ total_item.debit|accounting_amount }}</td>
|
||||
<td class="amount">{{ total_item.credit|accounting_amount }}</td>
|
||||
<td class="amount">{{ total_item.debit_amount|accounting_amount }}</td>
|
||||
<td class="amount">{{ total_item.credit_amount|accounting_amount }}</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
@ -133,14 +133,14 @@ First written: 2020/7/19
|
||||
<a class="list-group-item-action d-flex justify-content-between align-items-center" href="{% url "accounting:ledger" item period %}">
|
||||
{{ item.title|title }}
|
||||
<div>
|
||||
{% if item.debit is not None %}
|
||||
{% if item.debit_amount is not None %}
|
||||
<span class="badge badge-success badge-pill">
|
||||
{{ item.debit|intcomma:False }}
|
||||
{{ item.debit_amount|intcomma:False }}
|
||||
</span>
|
||||
{% endif %}
|
||||
{% if item.credit is not None %}
|
||||
{% if item.credit_amount is not None %}
|
||||
<span class="badge badge-warning badge-pill">
|
||||
{{ item.credit|intcomma:False }}
|
||||
{{ item.credit_amount|intcomma:False }}
|
||||
</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
@ -151,10 +151,10 @@ First written: 2020/7/19
|
||||
{% trans "Total" context "Accounting|" as text %}{{ text|force_escape }}
|
||||
<div>
|
||||
<span class="badge badge-success badge-pill">
|
||||
{{ total_item.debit|intcomma:False }}
|
||||
{{ total_item.debit_amount|intcomma:False }}
|
||||
</span>
|
||||
<span class="badge badge-warning badge-pill">
|
||||
{{ total_item.credit|intcomma:False }}
|
||||
{{ total_item.credit_amount|intcomma:False }}
|
||||
</span>
|
||||
</div>
|
||||
</li>
|
||||
|
@ -514,16 +514,16 @@ def trial_balance(request, period):
|
||||
| Q(code__startswith="2")
|
||||
| Q(code__startswith="3")))
|
||||
.annotate(
|
||||
balance=Sum(Case(
|
||||
amount=Sum(Case(
|
||||
When(record__is_credit=True, then=-1),
|
||||
default=1) * F("record__amount")))
|
||||
.filter(balance__isnull=False)
|
||||
.filter(amount__isnull=False)
|
||||
.annotate(
|
||||
debit=Case(
|
||||
When(balance__gt=0, then=F("balance")),
|
||||
debit_amount=Case(
|
||||
When(amount__gt=0, then=F("amount")),
|
||||
default=None),
|
||||
credit=Case(
|
||||
When(balance__lt=0, then=-F("balance")),
|
||||
credit_amount=Case(
|
||||
When(amount__lt=0, then=-F("amount")),
|
||||
default=None))
|
||||
.order_by("code"))
|
||||
real = list(
|
||||
@ -535,16 +535,16 @@ def trial_balance(request, period):
|
||||
| Q(code__startswith="3")),
|
||||
~Q(code=Account.ACCUMULATED_BALANCE))
|
||||
.annotate(
|
||||
balance=Sum(Case(
|
||||
amount=Sum(Case(
|
||||
When(record__is_credit=True, then=-1),
|
||||
default=1) * F("record__amount")))
|
||||
.filter(balance__isnull=False)
|
||||
.filter(amount__isnull=False)
|
||||
.annotate(
|
||||
debit=Case(
|
||||
When(balance__gt=0, then=F("balance")),
|
||||
debit_amount=Case(
|
||||
When(amount__gt=0, then=F("amount")),
|
||||
default=None),
|
||||
credit=Case(
|
||||
When(balance__lt=0, then=-F("balance")),
|
||||
credit_amount=Case(
|
||||
When(amount__lt=0, then=-F("amount")),
|
||||
default=None))
|
||||
.order_by("code"))
|
||||
balance = Record.objects \
|
||||
@ -563,20 +563,20 @@ def trial_balance(request, period):
|
||||
brought_forward = Account.objects.get(
|
||||
code=Account.ACCUMULATED_BALANCE)
|
||||
if balance > 0:
|
||||
brought_forward.debit = balance
|
||||
brought_forward.credit = 0
|
||||
brought_forward.debit_amount = balance
|
||||
brought_forward.credit_amount = None
|
||||
else:
|
||||
brought_forward.debit = None
|
||||
brought_forward.credit = -balance
|
||||
brought_forward.debit_amount = None
|
||||
brought_forward.credit_amount = -balance
|
||||
real.append(brought_forward)
|
||||
accounts = nominal + real
|
||||
accounts.sort(key=lambda x: x.code)
|
||||
total_account = Account()
|
||||
total_account.title = pgettext("Accounting|", "Total")
|
||||
total_account.debit = sum([x.debit for x in accounts
|
||||
if x.debit is not None])
|
||||
total_account.credit = sum([x.credit for x in accounts
|
||||
if x.credit is not None])
|
||||
total_account.debit_amount = sum([x.debit_amount for x in accounts
|
||||
if x.debit_amount is not None])
|
||||
total_account.credit_amount = sum([x.credit_amount for x in accounts
|
||||
if x.credit_amount is not None])
|
||||
return render(request, "accounting/trial-balance.html", {
|
||||
"item_list": accounts,
|
||||
"total_item": total_account,
|
||||
@ -619,10 +619,10 @@ def income_statement(request, period):
|
||||
| Q(code__startswith="2")
|
||||
| Q(code__startswith="3")))
|
||||
.annotate(
|
||||
balance=Sum(Case(
|
||||
amount=Sum(Case(
|
||||
When(record__is_credit=True, then=1),
|
||||
default=-1) * F("record__amount")))
|
||||
.filter(balance__isnull=False)
|
||||
.filter(amount__isnull=False)
|
||||
.order_by("code"))
|
||||
groups = list(Account.objects.filter(
|
||||
code__in=[x.code[:2] for x in accounts]))
|
||||
@ -643,17 +643,14 @@ def income_statement(request, period):
|
||||
for group in section.groups:
|
||||
group.details = [x for x in accounts
|
||||
if x.code[:2] == group.code]
|
||||
group.balance = None
|
||||
group.total = sum([x.balance
|
||||
group.amount = sum([x.amount
|
||||
for x in group.details])
|
||||
section.balance = None
|
||||
section.total = sum([x.total for x in section.groups])
|
||||
cumulative_total = cumulative_total + section.total
|
||||
section.amount = sum([x.amount for x in section.groups])
|
||||
cumulative_total = cumulative_total + section.amount
|
||||
if section.code in cumulative_accounts:
|
||||
section.cumulative_total \
|
||||
= cumulative_accounts[section.code]
|
||||
section.cumulative_total.balance = None
|
||||
section.cumulative_total.total = cumulative_total
|
||||
section.cumulative_total.amount = cumulative_total
|
||||
else:
|
||||
section.cumulative_total = None
|
||||
section.has_next = True
|
||||
@ -699,10 +696,10 @@ def balance_sheet(request, period):
|
||||
| Q(code__startswith="3")),
|
||||
~Q(code=Account.ACCUMULATED_BALANCE))
|
||||
.annotate(
|
||||
balance=Sum(Case(
|
||||
amount=Sum(Case(
|
||||
When(record__is_credit=True, then=-1),
|
||||
default=1) * F("record__amount")))
|
||||
.filter(balance__isnull=False)
|
||||
.filter(amount__isnull=False)
|
||||
.order_by("code"))
|
||||
for account in accounts:
|
||||
account.url = reverse("accounting:ledger", args=(account, period))
|
||||
@ -720,7 +717,7 @@ def balance_sheet(request, period):
|
||||
if balance is not None and balance != 0:
|
||||
brought_forward = Account.objects.get(
|
||||
code=Account.ACCUMULATED_BALANCE)
|
||||
brought_forward.balance = balance
|
||||
brought_forward.amount = balance
|
||||
brought_forward.url = reverse(
|
||||
"accounting:income-statement", args=(period,))
|
||||
accounts.append(brought_forward)
|
||||
@ -738,12 +735,12 @@ def balance_sheet(request, period):
|
||||
default=1) * F("amount")))["balance"]
|
||||
if balance is not None and balance != 0:
|
||||
net_change = Account.objects.get(code=Account.NET_CHANGE)
|
||||
net_change.balance = balance
|
||||
net_change.amount = balance
|
||||
net_change.url = reverse(
|
||||
"accounting:income-statement", args=(period,))
|
||||
accounts.append(net_change)
|
||||
for account in [x for x in accounts if x.code[0] in "23"]:
|
||||
account.balance = -account.balance
|
||||
account.amount = -account.amount
|
||||
groups = list(Account.objects.filter(
|
||||
code__in=[x.code[:2] for x in accounts]))
|
||||
sections = list(Account.objects.filter(
|
||||
@ -754,9 +751,9 @@ def balance_sheet(request, period):
|
||||
for group in section.groups:
|
||||
group.details = [x for x in accounts
|
||||
if x.code[:2] == group.code]
|
||||
group.balance = sum([x.balance
|
||||
group.amount = sum([x.amount
|
||||
for x in group.details])
|
||||
section.balance = sum([x.balance for x in section.groups])
|
||||
section.amount = sum([x.amount for x in section.groups])
|
||||
by_code = {x.code: x for x in sections}
|
||||
return render(request, "accounting/balance-sheet.html", {
|
||||
"assets": by_code["1"],
|
||||
|
Loading…
Reference in New Issue
Block a user