2020-05-31 12:08:26 +00:00
|
|
|
from django.conf import settings
|
|
|
|
from django.urls import reverse_lazy
|
|
|
|
|
2020-06-02 15:58:20 +00:00
|
|
|
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
|
2020-05-31 12:08:26 +00:00
|
|
|
|
2020-06-02 15:58:20 +00:00
|
|
|
class InvoiceListView(BackendListView):
|
|
|
|
template_name = f"{settings.EXPEPHALON_BACKEND}/invoices/index.html"
|
|
|
|
model = Invoice
|
2020-06-09 04:20:14 +00:00
|
|
|
title = "Invoices"
|
2020-05-31 12:08:26 +00:00
|
|
|
|
2020-06-02 15:58:20 +00:00
|
|
|
class InvoiceEditView(BackendUpdateView):
|
|
|
|
template_name = f"{settings.EXPEPHALON_BACKEND}/invoices/update.html"
|
|
|
|
model = Invoice
|
2020-06-03 10:35:23 +00:00
|
|
|
success_url = reverse_lazy("invoices")
|
2020-06-01 16:29:22 +00:00
|
|
|
fields = ["name", "logo", "address1", "address2", "zip", "city", "state", "country", "vat_id", "company_id"]
|
2020-06-09 04:20:14 +00:00
|
|
|
title = "Edit Invoice"
|
2020-05-31 12:08:26 +00:00
|
|
|
|
2020-06-02 15:58:20 +00:00
|
|
|
class InvoiceDeleteView(BackendDeleteView):
|
|
|
|
template_name = f"{settings.EXPEPHALON_BACKEND}/invoices/delete.html"
|
|
|
|
model = Invoice
|
2020-06-03 10:35:23 +00:00
|
|
|
success_url = reverse_lazy("invoices")
|
2020-06-09 04:20:14 +00:00
|
|
|
title = "Delete Invoice"
|
2020-05-31 12:08:26 +00:00
|
|
|
|
2020-06-02 15:58:20 +00:00
|
|
|
class InvoiceCreateView(BackendCreateView):
|
|
|
|
template_name = f"{settings.EXPEPHALON_BACKEND}/invoices/create.html"
|
|
|
|
model = Invoice
|
2020-06-03 10:35:23 +00:00
|
|
|
success_url = reverse_lazy("invoices")
|
2020-06-09 04:20:14 +00:00
|
|
|
fields = ["client", "brand", "number", "created", "due", "payment_method", "currency"]
|
|
|
|
title = "Create Invoice"
|