fix prints

This commit is contained in:
aminhashemi92 2025-10-09 16:17:01 +03:30
parent 6367d34f0c
commit 10810f8700
15 changed files with 423 additions and 245 deletions

View file

@ -1,7 +1,23 @@
from django import template
from _helpers.utils import jalali_converter2
from _helpers.utils import jalali_converter2, amount_to_persian_words
register = template.Library()
@register.filter(name='to_jalali')
def to_jalali(value):
return jalali_converter2(value)
return jalali_converter2(value)
@register.filter(name='amount_to_words')
def amount_to_words(value):
"""تبدیل مبلغ به حروف فارسی"""
try:
if value is None or value == '':
return ""
# تبدیل Decimal به int
from decimal import Decimal
if isinstance(value, Decimal):
value = int(value)
result = amount_to_persian_words(value)
return result if result else "صفر ریال"
except Exception as e:
return f"خطا: {str(e)}"