fix invoice in admin
This commit is contained in:
parent
b1423f0a07
commit
0f66e897a1
2 changed files with 3 additions and 1 deletions
|
|
@ -63,7 +63,9 @@ class InvoiceAdmin(SimpleHistoryAdmin):
|
|||
def remaining_amount_display(self, obj):
|
||||
amount = obj.get_remaining_amount()
|
||||
color = "green" if amount <= 0 else "red"
|
||||
return format_html('<span style="color: {};">{:,.0f} ریال</span>', color, amount)
|
||||
# Pre-format the number to avoid applying a numeric format code to a SafeString
|
||||
formatted_amount = f"{amount:,.0f}"
|
||||
return format_html('<span style="color: {};">{} ریال</span>', color, formatted_amount)
|
||||
remaining_amount_display.short_description = "مبلغ باقیمانده"
|
||||
|
||||
@admin.register(Payment)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue