from django.contrib import admin
from .models import Supplier, Customer, PurchaseOrder, Account, Transaction, JournalEntry, Project
from .models import AccountCategory, AccountSubType,  AccountingPeriod, PurchaseReturn, PurchaseReturnItem, Warehouse
from .models import Product


admin.site.register(Supplier)
admin.site.register(Customer)
# admin.site.register(Product)
# admin.site.register(Job)
admin.site.register(PurchaseOrder)
admin.site.register(Account)
admin.site.register(Transaction)
admin.site.register(JournalEntry)
admin.site.register(AccountCategory)
admin.site.register(AccountSubType)
admin.site.register(AccountingPeriod)
admin.site.register(PurchaseReturn)
admin.site.register(PurchaseReturnItem)
admin.site.register(Product)



# @admin.register(PurchaseOrder)
# class PurchaseOrderAdmin(admin.ModelAdmin):
#     list_display = ('po_number', 'supplier', 'status', 'order_date', 'total_amount')
#     actions = ['mark_as_completed']
    
#     def mark_as_completed(self, request, queryset):
#         for po in queryset:
#             po.status = 'completed'
#             po.save()  # This will trigger the stock movement creation
#         self.message_user(request, f"{queryset.count()} purchase orders marked as completed")
#     mark_as_completed.short_description = "Mark selected as completed"