diff --git a/inventory/templatetags/custom_filters.py b/inventory/templatetags/custom_filters.py index 72f5c9f8..f096dcf0 100644 --- a/inventory/templatetags/custom_filters.py +++ b/inventory/templatetags/custom_filters.py @@ -13,7 +13,16 @@ from django.db.models import Case, Value, When, IntegerField register = template.Library() - +@register.filter +def is_negative(value): + """ + Checks if the given value is a negative number. + """ + try: + return float(value) < 0 + except (ValueError, TypeError): + return False + @register.filter def get_percentage(value, total): try: diff --git a/templates/dashboards/partials/financial_data_cards.html b/templates/dashboards/partials/financial_data_cards.html index 373b5072..e3216c64 100644 --- a/templates/dashboards/partials/financial_data_cards.html +++ b/templates/dashboards/partials/financial_data_cards.html @@ -302,9 +302,16 @@
{% trans "Gross Profit" %}
-