Commit ef1e6b79 authored by Patrick Kimber's avatar Patrick Kimber

Add invoice detail to invoice issue form

parent 2fc41a2d
{% for description in issue.lines %}
{% if not forloop.first %}
<br>
{% endif %}
{% if forloop.first and forloop.last %}
{{ description }}
{% else %}
{{ forloop.counter }}. {{ description }}
{% endif %}
{% endfor %}
{% if issue.comment %}
<br>
<strong>
Comment:
</strong>
{{ issue.comment|truncatewords_html:10 }}
{% endif %}
<thead>
<tr>
<td colspan="3">
Issues
<i class="fa fa-info-circle"></i>
</td>
</tr>
<tr valign="top">
<th>Status</th>
<th>Invoice / Credit</th>
<th>Invoice / Credit Note</th>
<th>Description</th>
</tr>
</thead>
<tbody>
{% for issue in invoiceissue_list %}
<tr>
<td colspan="3">Issues</td>
</tr>
<tr valign="top">
<td>
<a href="{% url 'invoice.issue.update' issue.pk %}">
<a href="{% url 'invoice.issue.update' issue.pk %}?next={{ request.get_full_path|urlencode }}">
{% if issue.confirmed %}
Confirmed
<i class="fa fa-check"></i>
{% else %}
<i class="fa fa-edit"></i>
Resolve
Resolve #{{ issue.pk }}
{% endif %}
</a>
</td>
......@@ -28,23 +31,7 @@
</a>
</td>
<td>
{% for description in issue.lines %}
{% if not forloop.first %}
<br>
{% endif %}
{% if forloop.first and forloop.last %}
{{ description }}
{% else %}
{{ forloop.counter }}. {{ description }}
{% endif %}
{% endfor %}
{% if issue.comment %}
<br>
<strong>
Comment:
</strong>
{{ issue.comment|truncatewords_html:10 }}
{% endif %}
{% include 'invoice/_invoice_issue_description.html' %}
</td>
</tr>
{% endfor %}
......
{% extends "invoice/base.html" %} {% block sub_title %} Invoice Issue {{ object.pk }} {% endblock sub_title %} {% block sub_heading %} Invoice issue {{ object.pk }} {% endblock sub_heading %} {% block content %}
<div class="pure-g">
<div class="pure-u-1">
{% include '_form.html' with inline_checkbox=True %}
{% extends "invoice/base.html" %}
{% block sub_title %}
Invoice Issue {{ object.pk }}
{% endblock sub_title %}
{% block sub_heading %}
Invoice issue {{ object.pk }}
{% endblock sub_heading %}
{% block content %}
<div class="pure-menu pure-menu-horizontal">
<ul class="pure-menu-list">
<li class="pure-menu-item">
{% if next %}
<a href="{{ next }}" class="pure-menu-link">
<i class="fa fa-reply"></i>
</a>
{% else %}
<a href="{% url 'project.dash' %}" class="pure-menu-link">
<i class="fa fa-reply"></i>
Dashboard
</a>
{% endif %}
</li>
</ul>
</div>
<div class="pure-g">
<div class="pure-u-1">
<table class="pure-table pure-table-bordered">
<tbody>
<tr valign="top">
<td>
<strong>
Issue
</strong>
</td>
<td>
#{{ invoiceissue.pk }}
</td>
</tr>
<tr valign="top">
<td>
<strong>
{% if invoiceissue.invoice.is_credit %}
Credit Note
{% else %}
Invoice
{% endif %}
</strong>
</td>
<td>
<a href="{% url 'invoice.detail' invoiceissue.invoice.pk %}">
{{ invoiceissue.invoice.invoice_number }}
</a>
</td>
</tr>
<tr valign="top">
<td>
<strong>
{% if invoiceissue.invoice.is_credit %}
Credit Note
{% else %}
Invoice
{% endif %}
Date
</strong>
</td>
<td>
{{ invoiceissue.invoice.invoice_date|date:'d/m/Y' }}
</td>
</tr>
<tr valign="top">
<td>
<strong>
Description
</strong>
</td>
<td>
{% include 'invoice/_invoice_issue_description.html' with issue=invoiceissue %}
</td>
</tr>
</tbody>
</table>
<br>
{% include '_form.html' with inline_checkbox=True submit='Resolve...' %}
</div>
</div>
</div>
{% endblock content %}
......@@ -524,21 +524,39 @@ class InvoiceDraftCreateView(
class InvoiceIssueUpdateView(
LoginRequiredMixin, StaffuserRequiredMixin, BaseMixin, UpdateView
LoginRequiredMixin,
StaffuserRequiredMixin,
RedirectNextMixin,
BaseMixin,
UpdateView,
):
form_class = InvoiceIssueForm
model = InvoiceIssue
def form_valid(self, form):
result = super().form_valid(form)
if self.object.confirmed:
caption = (
"credit note" if self.object.invoice.is_credit else "Invoice"
)
messages.info(
self.request,
"Resolved issue #{} for {} {} dated {}".format(
self.object.pk,
caption,
self.object.invoice.invoice_number,
self.object.invoice.invoice_date.strftime("%d/%m/%Y"),
),
)
return result
def get_success_url(self):
return reverse(
"invoice.reconcile.day",
args=[
self.object.invoice.invoice_date.year,
self.object.invoice.invoice_date.month,
self.object.invoice.invoice_date.day,
],
)
next_url = self.request.POST.get(REDIRECT_FIELD_NAME)
if next_url:
return next_url
else:
return reverse("project.dash")
class InvoiceLineCreateView(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment