20 lines
632 B
Python
20 lines
632 B
Python
from django.contrib import admin
|
|
from .models import Stock, StockMovement
|
|
|
|
|
|
class StockAdmin(admin.ModelAdmin):
|
|
list_display = ('product', 'quantity_available', 'quantity_reserved', 'updated_at')
|
|
list_filter = ('updated_at',)
|
|
search_fields = ('product__name', 'product__sku')
|
|
|
|
|
|
class StockMovementAdmin(admin.ModelAdmin):
|
|
list_display = ('product', 'change', 'reason', 'order', 'created_at')
|
|
list_filter = ('reason', 'created_at')
|
|
search_fields = ('product__name', 'order__id')
|
|
date_hierarchy = 'created_at'
|
|
|
|
|
|
admin.site.register(Stock, StockAdmin)
|
|
admin.site.register(StockMovement, StockMovementAdmin)
|