Fixed the cash account and ledger and restored the balance value of the pseudo records in the accounting application.
This commit is contained in:
parent
6f444442b1
commit
fe22f64b64
@ -130,18 +130,20 @@ def cash(request, account, period):
|
|||||||
else Transaction(date=timezone.localdate())),
|
else Transaction(date=timezone.localdate())),
|
||||||
account=account,
|
account=account,
|
||||||
summary=pgettext("Accounting|", "Total"),
|
summary=pgettext("Accounting|", "Total"),
|
||||||
balance=balance
|
|
||||||
)
|
)
|
||||||
|
record_sum.balance = balance
|
||||||
record_sum.credit_amount = sum([
|
record_sum.credit_amount = sum([
|
||||||
x.amount for x in records if x.is_credit])
|
x.amount for x in records if x.is_credit])
|
||||||
record_sum.debit_amount = sum([
|
record_sum.debit_amount = sum([
|
||||||
x.amount for x in records if not x.is_credit])
|
x.amount for x in records if not x.is_credit])
|
||||||
records.insert(0, Record(
|
record_balance_before = Record(
|
||||||
transaction=Transaction(date=period.start),
|
transaction=Transaction(date=period.start),
|
||||||
account=Account.objects.get(code="3351"),
|
account=Account.objects.get(code="3351"),
|
||||||
is_credit=balance_before >= 0,
|
is_credit=balance_before >= 0,
|
||||||
amount=abs(balance_before),
|
amount=abs(balance_before),
|
||||||
balance=balance_before))
|
)
|
||||||
|
record_balance_before.balance = balance_before
|
||||||
|
records.insert(0, record_balance_before)
|
||||||
records.append(record_sum)
|
records.append(record_sum)
|
||||||
pagination = Pagination(request, records, True)
|
pagination = Pagination(request, records, True)
|
||||||
records = pagination.items
|
records = pagination.items
|
||||||
@ -310,8 +312,8 @@ def ledger(request, account, period):
|
|||||||
summary=pgettext("Accounting|", "Brought Forward"),
|
summary=pgettext("Accounting|", "Brought Forward"),
|
||||||
is_credit=balance < 0,
|
is_credit=balance < 0,
|
||||||
amount=abs(balance),
|
amount=abs(balance),
|
||||||
balance=balance,
|
|
||||||
)
|
)
|
||||||
|
record_brought_forward.balance = balance
|
||||||
else:
|
else:
|
||||||
balance = 0
|
balance = 0
|
||||||
record_brought_forward = None
|
record_brought_forward = None
|
||||||
|
Loading…
Reference in New Issue
Block a user