Fix invoices not being shown on transactions
This commit is contained in:
parent
1f22ac7042
commit
c6c67b9f93
5 changed files with 16 additions and 13 deletions
|
@ -69,10 +69,6 @@ class Transaction(UserModel):
|
||||||
if self.statement:
|
if self.statement:
|
||||||
return self.statement.account
|
return self.statement.account
|
||||||
|
|
||||||
@property
|
|
||||||
def has_invoice(self):
|
|
||||||
return self.invoices.count() > 0
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ["-date", "statement"]
|
ordering = ["-date", "statement"]
|
||||||
verbose_name = _("Transaction")
|
verbose_name = _("Transaction")
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
{% load main_extras %}
|
{% load i18n main_extras %}
|
||||||
{% load i18n %}
|
|
||||||
<div id="invoices">
|
<div id="invoices">
|
||||||
<ul class="invoices">
|
<ul class="invoices">
|
||||||
{% for invoice in transaction.invoices %}
|
{% for invoice in invoices %}
|
||||||
<li>
|
<li>
|
||||||
<a class="title" href="{{ invoice.file.url }}">{{ "file"|remix }}{{ invoice.name }} [{{ invoice.file|extension }}]</a>
|
<a class="title" href="{{ invoice.file.url }}">{{ "file"|remix }}{{ invoice.name }} [{{ invoice.file|extension }}]</a>
|
||||||
<a href="{{ invoice.get_absolute_url }}">{{ "file-edit"|remix }}{% translate "Edit" %}</a>
|
<a href="{{ invoice.get_absolute_url }}">{{ "file-edit"|remix }}{% translate "Edit" %}</a>
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
{% extends "main/form/base.html" %}
|
{% extends "main/form/base.html" %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% load main_extras %}
|
{% load main_extras transaction_extras %}
|
||||||
{% block title %}
|
{% block title %}
|
||||||
{{ transaction }}
|
{{ transaction }}
|
||||||
– Nummi
|
– Nummi
|
||||||
{% endblock %}
|
{% endblock title %}
|
||||||
{% block link %}
|
{% block link %}
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
{% css "main/css/form.css" %}
|
{% css "main/css/form.css" %}
|
||||||
{% css "main/css/table.css" %}
|
{% css "main/css/table.css" %}
|
||||||
{% css "main/css/plot.css" %}
|
{% css "main/css/plot.css" %}
|
||||||
{% endblock %}
|
{% endblock link %}
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<h2>{{ transaction }}</h2>
|
<h2>{{ transaction }}</h2>
|
||||||
<section class="transaction-details">
|
<section class="transaction-details">
|
||||||
|
@ -43,6 +43,6 @@
|
||||||
</section>
|
</section>
|
||||||
<section>
|
<section>
|
||||||
<h3>{% translate "Invoices" %}</h3>
|
<h3>{% translate "Invoices" %}</h3>
|
||||||
{% include "transaction/invoice_table.html" %}
|
{% invoice_table transaction %}
|
||||||
</section>
|
</section>
|
||||||
{% endblock %}
|
{% endblock body %}
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
{% for trans in transactions %}
|
{% for trans in transactions %}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="c">
|
<td class="c">
|
||||||
{% for invoice in trans.invoices %}
|
{% for invoice in trans.invoice_set.all %}
|
||||||
<a class="i" href="{{ invoice.file.url }}">{{ "attachment"|remix }}</a>
|
<a class="i" href="{{ invoice.file.url }}">{{ "attachment"|remix }}</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -22,6 +22,14 @@ def transaction_table(transactions, **kwargs):
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@register.inclusion_tag("transaction/invoice_table.html")
|
||||||
|
def invoice_table(transaction, **kwargs):
|
||||||
|
return kwargs | {
|
||||||
|
"transaction": transaction,
|
||||||
|
"invoices": transaction.invoice_set.all(),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@register.simple_tag(takes_context=True)
|
@register.simple_tag(takes_context=True)
|
||||||
def month_url(context, month, cls="", fmt="Y-m"):
|
def month_url(context, month, cls="", fmt="Y-m"):
|
||||||
url_name, url_params = ac_url(
|
url_name, url_params = ac_url(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue