Monday, 20 July 2015

remove words from string in Jinjha

This post help you to remove selected word from string.
This is also useful to replace word in string.

I have used this feature to remove Currency and float precision in ERPNext print format
e.g 1) to remove USD and 'only' form string
{{ doc.total_amount_in_words | replace("USD", "") | replace("only.", "") }}

e.g. 2) to remove float precision
{{ doc.get_formatted("net_total_export", doc) | replace(".00", "") }}<br>

e.g. 3) apply multiple formats
{{ '{:20,.0f}'.format(55.258) }}