74 lines
2.1 KiB
Python
74 lines
2.1 KiB
Python
from django.contrib import admin
|
|
from .models.sales import Sale, SaleLine
|
|
from .models.customers import Customer
|
|
from .models.sales import (
|
|
Sale,
|
|
SaleLine,
|
|
CatalogSale,
|
|
CatalogSaleLine,
|
|
Payment,
|
|
)
|
|
from .models.products import Product, ProductCategory
|
|
from .models.payments import ReconciliationJar
|
|
|
|
|
|
@admin.register(Customer)
|
|
class CustomerAdmin(admin.ModelAdmin):
|
|
list_display = (
|
|
"name",
|
|
"email",
|
|
"phone",
|
|
"external_id",
|
|
"address_external_id",
|
|
)
|
|
search_fields = ("name", "email", "phone")
|
|
|
|
@admin.register(Sale)
|
|
class SaleAdmin(admin.ModelAdmin):
|
|
list_display = (
|
|
"id",
|
|
"date",
|
|
"customer",
|
|
"payment_method",
|
|
"external_id",
|
|
)
|
|
search_fields = ("date", "customer__name", "payment_method", "external_id")
|
|
list_filter = ("date", "customer__name", "payment_method")
|
|
|
|
@admin.register(SaleLine)
|
|
class SaleLineAdmin(admin.ModelAdmin):
|
|
list_display = ("sale", "product", "quantity", "unit_price")
|
|
search_fields = ("sale__id", "product__name")
|
|
list_filter = ("sale__date", "product__name")
|
|
|
|
@admin.register(CatalogSale)
|
|
class CatalogSaleAdmin(admin.ModelAdmin):
|
|
list_display = (
|
|
"id",
|
|
"date",
|
|
"customer_name",
|
|
"customer_phone",
|
|
"customer_address",
|
|
"pickup_method",
|
|
"external_id",
|
|
)
|
|
search_fields = ("date","customer_name", "customer_phone", "pickup_method","external_id")
|
|
list_filter = ("date", "customer_name", "pickup_method")
|
|
|
|
|
|
@admin.register(CatalogSaleLine)
|
|
class CatalogSaleLineAdmin(admin.ModelAdmin):
|
|
list_display = ("catalog_sale", "product", "quantity", "unit_price")
|
|
search_fields = ("catalog_sale__id", "product__name")
|
|
list_filter = ("catalog_sale__date", "product__name")
|
|
|
|
@admin.register(Product)
|
|
class ProductAdmin(admin.ModelAdmin):
|
|
list_display = ("name", "price", "measuring_unit", "external_id")
|
|
search_fields = ("id", "name",)
|
|
list_filter = ("name", "id")
|
|
|
|
admin.site.register(ProductCategory)
|
|
admin.site.register(Payment)
|
|
admin.site.register(ReconciliationJar)
|