mirror of https://gitlab.crans.org/bde/nk20
Add invoices in Django Admin
This commit is contained in:
parent
3e28ed8716
commit
e23eafd56c
|
@ -3,8 +3,9 @@
|
|||
|
||||
from django.contrib import admin
|
||||
from note_kfet.admin import admin_site
|
||||
from .forms import ProductForm
|
||||
|
||||
from .models import RemittanceType, Remittance, SogeCredit
|
||||
from .models import RemittanceType, Remittance, SogeCredit, Invoice, Product
|
||||
|
||||
|
||||
@admin.register(RemittanceType, site=admin_site)
|
||||
|
@ -39,3 +40,20 @@ class SogeCreditAdmin(admin.ModelAdmin):
|
|||
def has_add_permission(self, request):
|
||||
# Don't create a credit manually
|
||||
return False
|
||||
|
||||
|
||||
class ProductInline(admin.StackedInline):
|
||||
"""
|
||||
Inline product in invoice admin
|
||||
"""
|
||||
model = Product
|
||||
form = ProductForm
|
||||
|
||||
|
||||
@admin.register(Invoice, site=admin_site)
|
||||
class InvoiceAdmin(admin.ModelAdmin):
|
||||
"""
|
||||
Admin customisation for Invoice
|
||||
"""
|
||||
list_display = ('object', 'id', 'bde', 'name', 'date', 'acquitted',)
|
||||
inlines = (ProductInline,)
|
||||
|
|
|
@ -55,7 +55,7 @@ class Invoice(models.Model):
|
|||
|
||||
date = models.DateField(
|
||||
default=timezone.now,
|
||||
verbose_name=_("Place"),
|
||||
verbose_name=_("Date"),
|
||||
)
|
||||
|
||||
acquitted = models.BooleanField(
|
||||
|
|
Loading…
Reference in New Issue