Commit e3814b95 authored by Patrick Kimber's avatar Patrick Kimber

Check, tidy - "resolve" credit notes with issues.

https://www.kbsoftware.co.uk/crm/ticket/4705/
parent 0bd9e607
Pipeline #104056304 failed with stage
in 1 minute and 55 seconds
......@@ -11,7 +11,7 @@
{% if issue.comment %}
<br>
<strong>
Comment:
Resolution:
</strong>
{{ issue.comment|truncatewords_html:10 }}
{% endif %}
<thead>
<tr>
<td colspan="4">
<td colspan="5">
Issues
<i class="fa fa-info-circle"></i>
</td>
</tr>
<tr valign="top">
<th>ID</th>
<th>Status</th>
<th>Date</th>
<th>Invoice / Credit Note</th>
<th>Invoice / Credit</th>
<th>Description</th>
</tr>
</thead>
<tbody>
{% for issue in invoiceissue_list %}
<tr valign="top">
<td>
{{ issue.pk }}
</td>
<td>
<a href="{% url 'invoice.issue.update' issue.pk %}?next={{ request.get_full_path|urlencode }}">
{% if issue.confirmed %}
......@@ -22,7 +26,7 @@
<i class="fa fa-check"></i>
{% else %}
<i class="fa fa-edit"></i>
Resolve #{{ issue.pk }}
Resolve
{% endif %}
</a>
</td>
......
......@@ -27,7 +27,7 @@
</div>
<div class="pure-g">
<div class="pure-u-1">
<table class="pure-table pure-table-bordered">
<table class="pure-table pure-table-bordered" width="100%">
<tbody>
<tr valign="top">
<td>
......@@ -82,8 +82,7 @@
</tr>
</tbody>
</table>
<br>
{% include '_form.html' with inline_checkbox=True submit='Resolve...' %}
{% include '_form.html' with inline_checkbox=True %}
</div>
</div>
{% endblock content %}
{% extends 'dash/base.html' %}
{% load humanize %}
{% load static %}
{% block sub_heading %}
Invoice Issues
{% endblock sub_heading %}
{% block content %}
<div class="pure-g">
<div class="pure-u-1">
<div class="pure-menu pure-menu-horizontal">
<ul class="pure-menu-list">
<li class="pure-menu-item">
<a href="{% url 'project.dash' %}" class="pure-menu-link">
<i class="fa fa-reply"></i>
</a>
</li>
{% include 'base/_paginate_with_parameters.html' %}
</ul>
</div>
</div>
</div>
<div class="pure-g">
<div class="pure-u-1">
<table class="pure-table pure-table-bordered" width="100%">
{% include 'invoice/_invoice_issue_list.html' %}
</table>
</div>
</div>
{% endblock content %}
......@@ -213,6 +213,19 @@ def test_invoice_user_update(client):
assert True == obj.mail_time_summary
@pytest.mark.django_db
def test_issue_list(client):
user = UserFactory(is_staff=True)
assert client.login(username=user.username, password=TEST_PASSWORD) is True
InvoiceIssueFactory(comment="a")
InvoiceIssueFactory(comment="b")
response = client.get(reverse("invoice.issue.list"))
assert HTTPStatus.OK == response.status_code
assert "invoiceissue_list" in response.context
invoice_issue_list = response.context["invoiceissue_list"]
assert ["b", "a"] == [x.comment for x in invoice_issue_list]
@pytest.mark.django_db
def test_issue_update(client):
user = UserFactory(is_staff=True)
......
......@@ -110,6 +110,12 @@ def test_invoice_credit_list(perm_check):
perm_check.staff(url)
@pytest.mark.django_db
def test_invoice_issue_list(perm_check):
url = reverse("invoice.issue.list")
perm_check.staff(url)
@pytest.mark.django_db
def test_invoice_list(perm_check):
url = reverse("invoice.list")
......
......@@ -4,8 +4,8 @@ from django.urls import path
from .views import (
BatchListView,
BatchlessInvoiceListView,
BatchListView,
ContactInvoiceListView,
ContactReportUpdateView,
ContactTicketTimeRecordListView,
......@@ -15,6 +15,7 @@ from .views import (
InvoiceContactUpdateView,
InvoiceCreditListView,
InvoiceDraftCreateView,
InvoiceIssueListView,
InvoiceIssueUpdateView,
InvoiceLineCreateView,
InvoiceLineUpdateView,
......@@ -150,6 +151,11 @@ urlpatterns = [
view=InvoiceUpdateView.as_view(),
name="invoice.update",
),
url(
regex=r"^issue/$",
view=InvoiceIssueListView.as_view(),
name="invoice.issue.list",
),
# quick time record
url(
regex=r"^quick/time/record/$",
......
......@@ -523,6 +523,17 @@ class InvoiceDraftCreateView(
return kwargs
class InvoiceIssueListView(
LoginRequiredMixin,
StaffuserRequiredMixin,
RedirectNextMixin,
BaseMixin,
ListView,
):
model = InvoiceIssue
paginate_by = 20
class InvoiceIssueUpdateView(
LoginRequiredMixin,
StaffuserRequiredMixin,
......
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