feat: add billing pricing rules
This commit is contained in:
+36
-1
@@ -1,6 +1,6 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from .models import CallRecord, PointsLedger
|
||||
from .models import CallRecord, ExchangeRate, PointsLedger, PricingRule
|
||||
|
||||
|
||||
class ReadOnlyLedgerAdmin(admin.ModelAdmin):
|
||||
@@ -33,6 +33,41 @@ class PointsLedgerAdmin(ReadOnlyLedgerAdmin):
|
||||
ordering = ("-created_at", "-id")
|
||||
|
||||
|
||||
@admin.register(PricingRule)
|
||||
class PricingRuleAdmin(admin.ModelAdmin):
|
||||
list_display = (
|
||||
"operation_type",
|
||||
"alias",
|
||||
"resolution_display",
|
||||
"points_cost",
|
||||
"is_active",
|
||||
"updated_at",
|
||||
)
|
||||
list_filter = ("operation_type", "is_active")
|
||||
search_fields = ("alias", "resolution")
|
||||
ordering = ("operation_type", "alias", "resolution")
|
||||
readonly_fields = ("created_at", "updated_at")
|
||||
|
||||
@admin.display(description="resolution")
|
||||
def resolution_display(self, obj):
|
||||
return obj.resolution or "*"
|
||||
|
||||
|
||||
@admin.register(ExchangeRate)
|
||||
class ExchangeRateAdmin(admin.ModelAdmin):
|
||||
list_display = (
|
||||
"currency",
|
||||
"points_per_unit",
|
||||
"is_active",
|
||||
"effective_from",
|
||||
"updated_at",
|
||||
)
|
||||
list_filter = ("currency", "is_active")
|
||||
search_fields = ("currency", "note")
|
||||
ordering = ("-effective_from", "-id")
|
||||
readonly_fields = ("created_at", "updated_at")
|
||||
|
||||
|
||||
@admin.register(CallRecord)
|
||||
class CallRecordAdmin(ReadOnlyLedgerAdmin):
|
||||
list_display = (
|
||||
|
||||
Reference in New Issue
Block a user