In_words for print format

i want in words function showing output like “one hundred fifty thousand” instead of “one hundrer fifty thousand coma zero zero two”. i want to remove the word after coma. is anyone can help me with this? below i give my code

def in_words(integer, in_million=True, lang=None):
Returns string in words for the given integer.
frappe.local.lang = ‘id’
locale = ‘id’ if not in_million else frappe.local.lang
locale = lang if lang is not None else locale
ret = num2words(integer, lang=locale)
except NotImplementedError:
ret = num2words(integer, lang=‘id’)
except OverflowError:
ret = num2words(integer, lang=‘id’)
ret = ret.upper()
return ret.replace(‘-’, ’ ',0)

Have you tried

frappe.utils.money_in_words(doc.grand_total, do.currency)

i just try it and it show error message like jinja2.exceptions.UndefinedError: ‘do’ is undefined. am i miss something?


1 Like

use this

{{ frappe.utils.money_in_words((doc.grand_total)|round)}}

i try this but it keep showing “two thousand eleven six hundred coma zero”. i just need until “two thousand eleven six hundred”

Hi @AmateurDeveloper,

If you don’t want to comma then please apply it.

{{ frappe.utils.money_in_words(doc.grand_total) | replace (",", " ")}}