Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hypha/apply/activity/adapters/emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
CoApplicantProjectPermission,
CoApplicantRole,
)
from hypha.apply.projects.models.payment import (
from hypha.apply.projects.models.invoice import (
APPROVED_BY_FINANCE,
CHANGES_REQUESTED_BY_FINANCE,
CHANGES_REQUESTED_BY_STAFF,
Expand Down
2 changes: 1 addition & 1 deletion hypha/apply/activity/adapters/slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from hypha.apply.activity.adapters.base import AdapterBase
from hypha.apply.activity.adapters.utils import link_to, reviewers_message
from hypha.apply.activity.options import MESSAGES
from hypha.apply.projects.models.payment import (
from hypha.apply.projects.models.invoice import (
APPROVED_BY_STAFF,
CHANGES_REQUESTED_BY_FINANCE,
PAID,
Expand Down
2 changes: 1 addition & 1 deletion hypha/apply/activity/adapters/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from hypha.apply.activity.options import MESSAGES
from hypha.apply.projects.models import ProjectSettings
from hypha.apply.projects.models.payment import (
from hypha.apply.projects.models.invoice import (
APPROVED_BY_FINANCE,
CHANGES_REQUESTED_BY_STAFF,
DECLINED,
Expand Down
2 changes: 1 addition & 1 deletion hypha/apply/activity/tests/test_adapter_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from django.test import SimpleTestCase, TestCase

from hypha.apply.activity.options import MESSAGES
from hypha.apply.projects.models.payment import (
from hypha.apply.projects.models.invoice import (
APPROVED_BY_FINANCE,
APPROVED_BY_STAFF,
CHANGES_REQUESTED_BY_STAFF,
Expand Down
2 changes: 1 addition & 1 deletion hypha/apply/dashboard/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
ApplicationSubmissionFactory,
InvitedToProposalFactory,
)
from hypha.apply.projects.models.payment import (
from hypha.apply.projects.models.invoice import (
APPROVED_BY_STAFF,
CHANGES_REQUESTED_BY_STAFF,
DECLINED,
Expand Down
2 changes: 1 addition & 1 deletion hypha/apply/dashboard/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
)
from hypha.apply.projects.filters import ProjectListFilter
from hypha.apply.projects.models import Invoice, Project, ProjectSettings
from hypha.apply.projects.models.payment import DECLINED, PAID
from hypha.apply.projects.models.invoice import DECLINED, PAID
from hypha.apply.projects.tables import (
InvoiceDashboardTable,
PAFForReviewDashboardTable,
Expand Down
2 changes: 1 addition & 1 deletion hypha/apply/projects/constants.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.conf import settings
from django.utils.translation import gettext_lazy as _

from .models.payment import (
from .models.invoice import (
APPROVED_BY_FINANCE,
APPROVED_BY_STAFF,
CHANGES_REQUESTED_BY_FINANCE,
Expand Down
2 changes: 1 addition & 1 deletion hypha/apply/projects/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
get_used_funds,
)

from .models.payment import INVOICE_STATUS_CHOICES, Invoice
from .models.invoice import INVOICE_STATUS_CHOICES, Invoice
from .models.project import (
CLOSING,
INVOICING_AND_REPORTING,
Expand Down
2 changes: 1 addition & 1 deletion hypha/apply/projects/forms/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .payment import (
from .invoice import (
BatchUpdateInvoiceStatusForm,
ChangeInvoiceStatusForm,
CreateInvoiceForm,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from hypha.apply.funds.widgets import MultiCheckboxesWidget
from hypha.apply.stream_forms.fields import MultiFileField, SingleFileField

from ..models.payment import (
from ..models.invoice import (
APPROVED_BY_FINANCE,
APPROVED_BY_STAFF,
CHANGES_REQUESTED_BY_FINANCE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class Migration(migrations.Migration):
"invoice",
models.FileField(
storage=django.core.files.storage.FileSystemStorage(),
upload_to=hypha.apply.projects.models.payment.invoice_path,
upload_to=hypha.apply.projects.models.invoice.invoice_path,
),
),
(
Expand Down
4 changes: 2 additions & 2 deletions hypha/apply/projects/migrations/0037_add_project_invoicing.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import hypha.apply.projects.models.payment
import hypha.apply.projects.models.invoice


class Migration(migrations.Migration):
Expand Down Expand Up @@ -56,7 +56,7 @@ class Migration(migrations.Migration):
"document",
models.FileField(
storage=django.core.files.storage.FileSystemStorage(),
upload_to=hypha.apply.projects.models.payment.invoice_path,
upload_to=hypha.apply.projects.models.invoice.invoice_path,
),
),
("requested_at", models.DateTimeField(auto_now_add=True)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import datetime
import django.core.files.storage
import django.core.validators
import hypha.apply.projects.models.payment
import hypha.apply.projects.models.invoice
import hypha.apply.projects.models.project
from decimal import Decimal
from django.db import migrations, models
Expand Down Expand Up @@ -235,7 +235,7 @@ class Migration(migrations.Migration):
name="document",
field=models.FileField(
storage=django.core.files.storage.FileSystemStorage(),
upload_to=hypha.apply.projects.models.payment.invoice_path,
upload_to=hypha.apply.projects.models.invoice.invoice_path,
verbose_name="document",
),
),
Expand Down
2 changes: 1 addition & 1 deletion hypha/apply/projects/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .payment import Invoice, InvoiceExportManager, InvoiceTag, SupportingDocument
from .invoice import Invoice, InvoiceExportManager, InvoiceTag, SupportingDocument
from .project import (
Contract,
ContractDocumentCategory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,7 @@ def value(self):
return self.paid_value

def get_absolute_url(self):
return reverse(
"apply:projects:invoice-detail",
kwargs={"pk": self.project.pk, "invoice_pk": self.pk},
)
return reverse("apply:projects:invoice-detail", kwargs={"pk": self.pk})

@property
def filename(self):
Expand Down Expand Up @@ -337,11 +334,7 @@ def filename(self):
def get_absolute_url(self):
return reverse(
"apply:projects:invoice-supporting-document",
kwargs={
"pk": self.invoice.project.pk,
"invoice_pk": self.invoice.pk,
"file_pk": self.pk,
},
kwargs={"pk": self.invoice.pk, "file_pk": self.pk},
)


Expand Down
2 changes: 1 addition & 1 deletion hypha/apply/projects/service_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
FINANCE_GROUP_NAME,
)

from .models.payment import (
from .models.invoice import (
APPROVED_BY_FINANCE,
APPROVED_BY_STAFF,
CHANGES_REQUESTED_BY_FINANCE,
Expand Down
2 changes: 1 addition & 1 deletion hypha/apply/projects/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from hypha.apply.funds.tables import LabeledCheckboxColumn
from hypha.core.tables import RelativeTimeColumn

from .forms.payment import get_invoice_possible_transition_for_user
from .forms.invoice import get_invoice_possible_transition_for_user
from .models import Invoice, PAFApprovals, Project
from .utils import get_project_title

Expand Down
4 changes: 2 additions & 2 deletions hypha/apply/projects/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from celery import shared_task
from django.conf import settings

from hypha.apply.projects.models.payment import InvoiceExportManager
from hypha.apply.projects.models.invoice import InvoiceExportManager
from hypha.apply.projects.utils import export_invoices_to_csv
from hypha.apply.todo.options import (
DOWNLOAD_INVOICES_EXPORT,
Expand All @@ -21,7 +21,7 @@ def generate_invoice_csv(qs_ids: List[int], request_user_id: int) -> None:
adds a download task to the user's `My Tasks` when completed.
"""
try:
from hypha.apply.projects.models.payment import Invoice
from hypha.apply.projects.models.invoice import Invoice

qs = (
Invoice.objects.filter(id__in=qs_ids)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@
</p>
<p
class="lg:col-span-2"
hx-get="{% url 'apply:projects:partial-invoice-tags' pk=object.project.pk invoice_pk=object.pk %}"
hx-get="{% url 'apply:projects:partial-invoice-tags' pk=object.pk %}"
hx-trigger="load, invoicesUpdated from:body"
></p>
</div>
</section>

<!-- status -->
<section
hx-get="{% url 'apply:projects:partial-invoice-status' pk=object.project.pk invoice_pk=object.pk %}"
hx-get="{% url 'apply:projects:partial-invoice-status' pk=object.pk %}"
hx-trigger="load, invoicesUpdated from:body"
class="card card-border"
>
Expand All @@ -75,7 +75,7 @@
<h2 class="card-title">{% trans "Invoice" %}</h2>
<p class="max-w-md">
<c-card-attachment
href="{% url 'apply:projects:invoice-document' pk=object.project.pk invoice_pk=object.pk %}"
href="{% url 'apply:projects:invoice-document' pk=object.pk %}"
:filename="object.filename"
:exists="invoice_file_exists"
title="{% trans 'Download invoice' %}"
Expand All @@ -84,7 +84,7 @@ <h2 class="card-title">{% trans "Invoice" %}</h2>
{% if invoice_file_exists %}
<div class="overflow-x-auto mt-4">
<embed
src="{% url 'apply:projects:invoice-document' pk=object.project.pk invoice_pk=object.pk %}"
src="{% url 'apply:projects:invoice-document' pk=object.pk %}"
width="800px"
height="800px"
/>
Expand Down Expand Up @@ -112,7 +112,7 @@ <h2 class="card-title">{% trans "Supporting Documents" %}</h2>
<aside class="layout-sidebar">
<div
class="sticky top-8 card card-border bg-base-200 shadow-xs sidebar__inner--actions"
hx-get="{% url 'apply:projects:partial-invoice-detail-actions' pk=object.project.pk invoice_pk=object.pk %}"
hx-get="{% url 'apply:projects:partial-invoice-detail-actions' pk=object.pk %}"
hx-trigger="invoicesUpdated from:body"
data-testid="sidebar-primary-actions"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<div class="p-4">
<form
hx-post="{% url 'apply:projects:invoice-tags' pk=object.project.pk invoice_pk=object.pk %}"
hx-post="{% url 'apply:projects:invoice-tags' pk=object.pk %}"
hx-swap="innerHTML"
>
{% csrf_token %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ <h2 class="card-title">{% trans "Actions to take" %}</h2>
{% if user_can_change_status %}
<button
class="btn btn-primary btn-block"
hx-get="{% url 'apply:projects:invoice-update' pk=object.project.pk invoice_pk=object.pk %}"
hx-get="{% url 'apply:projects:invoice-update' pk=object.pk %}"
hx-target="#htmx-modal"
>
{% trans "Update Status" %}
Expand Down Expand Up @@ -37,7 +37,7 @@ <h4 class="modal__project-header-bar">{% trans "Update Invoice status" %}</h4>
{% endif %}
class="btn btn-secondary btn-outline btn-block"
href={% if user_can_edit_request %}
"{% url "apply:projects:invoice-edit" pk=object.project.pk invoice_pk=object.pk %}"
"{% url "apply:projects:invoice-edit" pk=object.pk %}"
{% else %}
"#"
{% endif %}
Expand All @@ -51,7 +51,7 @@ <h4 class="modal__project-header-bar">{% trans "Update Invoice status" %}</h4>
{% if user.is_apply_staff or user.is_finance %}
<button
class="btn btn-secondary btn-outline btn-block"
hx-get="{% url 'apply:projects:invoice-tags' pk=object.project.pk invoice_pk=object.pk %}"
hx-get="{% url 'apply:projects:invoice-tags' pk=object.pk %}"
hx-target="#htmx-modal"
>
{% heroicon_micro "tag" aria_hidden=true class="opacity-80 size-4" %}
Expand All @@ -64,7 +64,7 @@ <h4 class="modal__project-header-bar">{% trans "Update Invoice status" %}</h4>
{% if user_can_delete_request %}
<a
class="btn btn-error btn-outline btn-block"
hx-get="{% url 'apply:projects:invoice-delete' pk=object.project.pk invoice_pk=object.pk %}"
hx-get="{% url 'apply:projects:invoice-delete' pk=object.pk %}"
hx-target="#htmx-modal"
>
{% heroicon_micro "trash" aria_hidden=true class="opacity-80 size-4" %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{% if user_can_edit_request %}
<a
class="btn btn-sm btn-soft btn-secondary btn-square"
href="{% url 'apply:projects:invoice-edit' pk=invoice.project.pk invoice_pk=invoice.pk %}"
href="{% url 'apply:projects:invoice-edit' pk=invoice.pk %}"
>
{% heroicon_micro "pencil-square" aria_hidden=true %}
<span class="sr-only">{% trans "Edit" %}</span>
Expand All @@ -34,15 +34,15 @@
{% if not user.is_applicant and not user_can_delete_request %}
<a
class="btn btn-sm btn-outline btn-error btn-square"
href="{% url 'apply:projects:invoice-delete' pk=invoice.project.pk invoice_pk=invoice.pk %}"
href="{% url 'apply:projects:invoice-delete' pk=invoice.pk %}"
>
{% heroicon_micro "trash" aria_hidden=true %}
<span class="sr-only">{% trans "Delete" %}</span>
</a>
{% endif %}
{% can_change_status invoice user as can_change_invoice_status %}
{% if can_change_invoice_status %}
<button class="btn btn-sm btn-primary" hx-get="{% url 'apply:projects:invoice-update' pk=invoice.project.pk invoice_pk=invoice.pk %}" hx-target="#htmx-modal">
<button class="btn btn-sm btn-primary" hx-get="{% url 'apply:projects:invoice-update' pk=invoice.pk %}" hx-target="#htmx-modal">
{% trans "Update Status" %}
</button>
{% endif %}
Expand Down
4 changes: 2 additions & 2 deletions hypha/apply/projects/templatetags/invoice_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from hypha.apply.projects.constants import (
INVOICE_STATUS_CLASSNAME_MAP,
)
from hypha.apply.projects.models.payment import PAID
from hypha.apply.projects.models.invoice import PAID
from hypha.apply.projects.models.project import (
CLOSING,
COMPLETE,
Expand Down Expand Up @@ -70,7 +70,7 @@ def project_can_have_invoices(project):

@register.simple_tag
def get_invoice_form(invoice, user):
from hypha.apply.projects.views.payment import ChangeInvoiceStatusForm
from hypha.apply.projects.views.invoice import ChangeInvoiceStatusForm

form = ChangeInvoiceStatusForm(instance=invoice, user=user)
if form:
Expand Down
2 changes: 1 addition & 1 deletion hypha/apply/projects/tests/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from hypha.apply.users.tests.factories import GroupFactory, StaffFactory, UserFactory
from hypha.home.factories import ApplySiteFactory

from ..models.payment import Invoice, SupportingDocument
from ..models.invoice import Invoice, SupportingDocument
from ..models.project import (
COMPLETE,
INVOICING_AND_REPORTING,
Expand Down
4 changes: 2 additions & 2 deletions hypha/apply/projects/tests/test_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from hypha.home.factories import ApplySiteFactory

from ..files import get_files
from ..forms.payment import (
from ..forms.invoice import (
ChangeInvoiceStatusForm,
CreateInvoiceForm,
EditInvoiceForm,
Expand All @@ -26,7 +26,7 @@
StaffUploadContractForm,
UploadContractForm,
)
from ..models.payment import (
from ..models.invoice import (
APPROVED_BY_FINANCE,
APPROVED_BY_STAFF,
CHANGES_REQUESTED_BY_FINANCE,
Expand Down
2 changes: 1 addition & 1 deletion hypha/apply/projects/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
StaffFactory,
)

from ..models.payment import (
from ..models.invoice import (
APPROVED_BY_FINANCE,
APPROVED_BY_STAFF,
CHANGES_REQUESTED_BY_FINANCE,
Expand Down
2 changes: 1 addition & 1 deletion hypha/apply/projects/tests/test_more_templatetags.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
StaffFactory,
)

from ..models.payment import (
from ..models.invoice import (
DECLINED,
PAID,
SUBMITTED,
Expand Down
2 changes: 1 addition & 1 deletion hypha/apply/projects/tests/test_templatetags.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
StaffFactory,
)

from ..models.payment import (
from ..models.invoice import (
CHANGES_REQUESTED_BY_STAFF,
DECLINED,
PAID,
Expand Down
2 changes: 1 addition & 1 deletion hypha/apply/projects/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
INT_STAFF_PENDING,
INT_VENDOR_PENDING,
)
from ..models.payment import (
from ..models.invoice import (
APPROVED_BY_FINANCE,
APPROVED_BY_STAFF,
CHANGES_REQUESTED_BY_FINANCE,
Expand Down
Loading