expephalon/core/views/backend/invoices.py

30 lines
1.2 KiB
Python

from django.conf import settings
from django.urls import reverse_lazy
from core.models.invoices import Invoice, InvoiceItem
from core.views.backend.generic import BackendListView, BackendUpdateView, BackendDeleteView, BackendCreateView
class InvoiceListView(BackendListView):
template_name = f"{settings.EXPEPHALON_BACKEND}/invoices/index.html"
model = Invoice
title = "Invoices"
class InvoiceEditView(BackendUpdateView):
template_name = f"{settings.EXPEPHALON_BACKEND}/invoices/update.html"
model = Invoice
success_url = reverse_lazy("invoices")
fields = ["client", "brand", "number", "created", "due", "payment_method", "currency"]
title = "Edit Invoice"
class InvoiceDeleteView(BackendDeleteView):
template_name = f"{settings.EXPEPHALON_BACKEND}/invoices/delete.html"
model = Invoice
success_url = reverse_lazy("invoices")
title = "Delete Invoice"
class InvoiceCreateView(BackendCreateView):
template_name = f"{settings.EXPEPHALON_BACKEND}/invoices/create.html"
model = Invoice
success_url = reverse_lazy("invoices")
fields = ["client", "brand", "number", "created", "due", "payment_method", "currency"]
title = "Create Invoice"