expephalon/core/views/backend/invoices.py

31 lines
1.2 KiB
Python
Raw Normal View History

from django.conf import settings
from django.urls import reverse_lazy
from core.models.invoices import Invoice, InvoiceItem
2020-06-03 15:05:18 +00:00
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 = ["name", "logo", "address1", "address2", "zip", "city", "state", "country", "vat_id", "company_id"]
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"