forked from erp-dev/erp
feat: statement for supplier and customer
This commit is contained in:
@@ -125,6 +125,68 @@ class SalesReturnOrderItemAdmin(admin.ModelAdmin):
|
||||
return obj.total_amount()
|
||||
|
||||
|
||||
@admin.register(models.SalesOrder)
|
||||
class SalesOrderAdmin(admin.ModelAdmin):
|
||||
list_display = ('id', 'customer', 'sales_date', 'operator', 'status', '_total_amount', '_diff_quantity', '_total_quantity', 'created_at')
|
||||
search_fields = ('customer__name',)
|
||||
list_filter = ('operator', 'warehouse', 'status', 'created_at')
|
||||
ordering = ('-created_at',)
|
||||
|
||||
@admin.display(description='总价')
|
||||
def _total_amount(self, obj: models.SalesOrder):
|
||||
return obj.get_total_amount()
|
||||
|
||||
@admin.display(description='差异数量')
|
||||
def _diff_quantity(self, obj: models.SalesOrder):
|
||||
return obj.get_total_diff_quantity()
|
||||
|
||||
@admin.display(description='总数量')
|
||||
def _total_quantity(self, obj: models.SalesOrder):
|
||||
return obj.get_total_quantity()
|
||||
|
||||
|
||||
@admin.register(models.SalesOrderItem)
|
||||
class SalesOrderItemAdmin(admin.ModelAdmin):
|
||||
list_display = (
|
||||
'id', 'sales_order', 'product',
|
||||
'quantity', 'unit', 'price', 'batch_number',
|
||||
'_total_amount', 'empty_diff_percent',
|
||||
'_real_quantity', '_diff_quantity',
|
||||
'num_of_rolls',
|
||||
)
|
||||
search_fields = ('sales_order__id', 'product__name')
|
||||
list_filter = ('sales_order__operator', 'sales_order__warehouse', 'created_at')
|
||||
ordering = ('-created_at',)
|
||||
|
||||
@admin.display(description='实际数量')
|
||||
def _real_quantity(self, obj: models.SalesOrderItem):
|
||||
return obj.real_quantity()
|
||||
|
||||
@admin.display(description='差异数量')
|
||||
def _diff_quantity(self, obj: models.SalesOrderItem):
|
||||
return obj.diff_quantity()
|
||||
|
||||
@admin.display(description='总金额')
|
||||
def _total_amount(self, obj: models.SalesOrderItem):
|
||||
return obj.total_amount()
|
||||
|
||||
|
||||
@admin.register(models.PaymentOrder)
|
||||
class PaymentOrderAdmin(admin.ModelAdmin):
|
||||
list_display = ('id', 'supplier', 'payment_date', 'amount', 'operator', 'status', 'created_at')
|
||||
search_fields = ('supplier__name',)
|
||||
list_filter = ('operator', 'status', 'created_at')
|
||||
ordering = ('-created_at',)
|
||||
|
||||
|
||||
@admin.register(models.ReceiptOrder)
|
||||
class ReceiptOrderAdmin(admin.ModelAdmin):
|
||||
list_display = ('id', 'customer', 'receipt_date', 'amount', 'operator', 'status', 'created_at')
|
||||
search_fields = ('customer__name',)
|
||||
list_filter = ('operator', 'status', 'created_at')
|
||||
ordering = ('-created_at',)
|
||||
|
||||
|
||||
@admin.register(models.CustomerBalance)
|
||||
class CustomerBalancemAdmin(admin.ModelAdmin):
|
||||
list_display = ('id', 'customer', 'balance', 'created_at')
|
||||
@@ -132,6 +194,13 @@ class CustomerBalancemAdmin(admin.ModelAdmin):
|
||||
ordering = ('-created_at',)
|
||||
|
||||
|
||||
@admin.register(models.SupplierBalance)
|
||||
class SupplierBalanceAdmin(admin.ModelAdmin):
|
||||
list_display = ('id', 'supplier', 'balance', 'created_at')
|
||||
search_fields = ('supplier__name',)
|
||||
ordering = ('-created_at',)
|
||||
|
||||
|
||||
@admin.register(models.BalanceChangeRecord)
|
||||
class BalanceChangeRecordAdmin(admin.ModelAdmin):
|
||||
list_display = ('id', 'merchant', 'target_type', 'source_type', 'source_id', 'delta', 'balance_before', 'balance_after', 'direction', 'created_at')
|
||||
|
||||
Reference in New Issue
Block a user