Revised the accounting_amount filter to return "-" on 0 in the accounting application.

This commit is contained in:
依瑪貓 2020-07-18 08:17:19 +08:00
parent cb0d42ddd8
commit 393535b6bd

View File

@ -29,6 +29,8 @@ register = template.Library()
def accounting_amount(value): def accounting_amount(value):
if value is None: if value is None:
return "" return ""
if value == 0:
return "-"
s = str(abs(value)) s = str(abs(value))
while True: while True:
m = re.match("^([1-9][0-9]*)([0-9]{3})", s) m = re.match("^([1-9][0-9]*)([0-9]{3})", s)