1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-12-22 15:32:22 +00:00

Add invoices in Django Admin

This commit is contained in:
Yohann D'ANELLO 2020-08-06 21:51:53 +02:00
parent 3e28ed8716
commit e23eafd56c
2 changed files with 20 additions and 2 deletions

View File

@ -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,)

View File

@ -55,7 +55,7 @@ class Invoice(models.Model):
date = models.DateField(
default=timezone.now,
verbose_name=_("Place"),
verbose_name=_("Date"),
)
acquitted = models.BooleanField(