Replaced the "transaction" property with the "url" property in the ReportEntry model of the income and expenses log, so that the report entry does not need to keep the transaction object.
This commit is contained in:
parent
d19d23fe37
commit
74eee034d0
@ -47,8 +47,6 @@ class ReportEntry:
|
|||||||
|
|
||||||
:param entry: The journal entry.
|
:param entry: The journal entry.
|
||||||
"""
|
"""
|
||||||
self.transaction: Transaction | None = None
|
|
||||||
"""The transaction."""
|
|
||||||
self.is_brought_forward: bool = False
|
self.is_brought_forward: bool = False
|
||||||
"""Whether this is the brought-forward entry."""
|
"""Whether this is the brought-forward entry."""
|
||||||
self.is_total: bool = False
|
self.is_total: bool = False
|
||||||
@ -67,14 +65,17 @@ class ReportEntry:
|
|||||||
"""The balance."""
|
"""The balance."""
|
||||||
self.note: str | None = None
|
self.note: str | None = None
|
||||||
"""The note."""
|
"""The note."""
|
||||||
|
self.url: str | None = None
|
||||||
|
"""The URL to the journal entry."""
|
||||||
if entry is not None:
|
if entry is not None:
|
||||||
self.transaction = entry.transaction
|
|
||||||
self.date = entry.transaction.date
|
self.date = entry.transaction.date
|
||||||
self.account = entry.account
|
self.account = entry.account
|
||||||
self.summary = entry.summary
|
self.summary = entry.summary
|
||||||
self.income = None if entry.is_debit else entry.amount
|
self.income = None if entry.is_debit else entry.amount
|
||||||
self.expense = entry.amount if entry.is_debit else None
|
self.expense = entry.amount if entry.is_debit else None
|
||||||
self.note = entry.transaction.note
|
self.note = entry.transaction.note
|
||||||
|
self.url = url_for("accounting.transaction.detail",
|
||||||
|
txn=entry.transaction)
|
||||||
|
|
||||||
|
|
||||||
class EntryCollector:
|
class EntryCollector:
|
||||||
|
@ -80,7 +80,7 @@ First written: 2023/3/5
|
|||||||
{% endwith %}
|
{% endwith %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% for entry in report.entries %}
|
{% for entry in report.entries %}
|
||||||
<a class="accounting-report-table-row" href="{{ url_for("accounting.transaction.detail", txn=entry.transaction)|accounting_append_next }}">
|
<a class="accounting-report-table-row" href="{{ entry.url|accounting_append_next }}">
|
||||||
{% include "accounting/report/include/income-expenses-row-desktop.html" %}
|
{% include "accounting/report/include/income-expenses-row-desktop.html" %}
|
||||||
</a>
|
</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@ -108,7 +108,7 @@ First written: 2023/3/5
|
|||||||
{% endwith %}
|
{% endwith %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% for entry in report.entries %}
|
{% for entry in report.entries %}
|
||||||
<a class="list-group-item list-group-item-action d-flex justify-content-between" href="{{ url_for("accounting.transaction.detail", txn=entry.transaction)|accounting_append_next }}">
|
<a class="list-group-item list-group-item-action d-flex justify-content-between" href="{{ entry.url|accounting_append_next }}">
|
||||||
{% include "accounting/report/include/income-expenses-row-mobile.html" %}
|
{% include "accounting/report/include/income-expenses-row-mobile.html" %}
|
||||||
</a>
|
</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
Loading…
Reference in New Issue
Block a user