In words amount customization

Hello, please help me to solve this problem, so in my country we make a currency symbole after the amount and not before, for example if the amount is 500 MAD (MAD is a moroccan currency) the in words should be like this : five hundred MAD. and without the (ONLY) added text at the end .
i tried to add a new custom text field to write it manually but in printing format i got (NONE) instead the text written.
please can you guide me to edit the erpnext files or something just to get the in_words as i want. if not possible just give me the solution for the manually entred text in custom field . i write in the html : {{ doc.my_field }} and i get NONE in printing.
Screenshot_3

help me please,

For q&a pointers search the forum for eg in_words or ‘currency symbol’

Use unix find to search the code itself How can you fetch the one who approved/submits? - #4 by clarkej

can you please give me the exact path and file ? and what i have to change ?

I can’t be sure, the idea is you wish to learn right?

1 Like

of course we all learn,
but i spent a long time searching for that solution without success, so please if you could help me to find that file and make the symbole after the amount, and delete that ‘’‘ONLY’‘’ and let just the words

This should help Search · money_in_words · GitHub

Another option is to set a breakpoint but that’s a separate learning :slight_smile:Chrome DevTools - Chrome Developers

hello Mr clarkej,
i deleted the ‘only’ word, from the code, but after i make the update for bench to take effect,
its giving an error, that some files are edited . here is the located ‘ONLY’ word.

		out = main_currency + ' ' + _(in_words(main, in_million).title())
		if cint(fraction):
			out = out + ' ' + _('and') + ' ' + _(in_words(fraction, in_million).title()) + ' ' + fraction_currency

	return out + ' ' + _('only.')

so what i have to do exactley ?

“its giving an error”

Good progress. What is the error, a traceback would be ideal.

Possibly these will help: run ‘bench build’ and delete the *.pyc you changed so they will be recompiled.

i ran bench’ update --reset’ . now erpnext is up.
but what i have to change to not get errors ?

I am not clear what you changed, what error you refer to, and what are you trying to do…you need to follow a process?

so what i want exactly is to remove the currency symbol from ‘in_words’ function example :
the original : ‘USD One hundred only.’ what i want show in printing : ‘One hundred’ without currency symbol and ‘only’.
by following your comments guides about in_words tracking . First i proceeded by removing the ‘only’ from the end of the amount in words.
so i proceed to search on this file :
frappe-bench/apps/frappe/ frappe/utils/data.py
i found the coding of converting numbers to words and i found ‘only’ word here
(just a part of the data.py code)

	out = main_currency + ' ' + _(in_words(main, in_million).title())
	if cint(fraction):
		out = out + ' ' + _('and') + ' ' + _(in_words(fraction, in_million).title()) + ' ' + fraction_currency

return out + ' ' + _('only.')

so i tried to test changing that word return out + ' ' + _('only.') to return out + ' ' + _('.')
buti got error when tried to update bench to take effects .
Cannot proceed with update: You have local changes in app "frappe" that are not committed.
i edited the file to its original and i made update. and erpnext got back working.
im not professional at coding, so what i must do exactly to remove the currency symbol + ‘only’ from the in_words in my printed documents (invoices sale orders …) ?
is there is an option code that i can add to the in_words field ?
or i must edit a files ? and what i have to edit ???

You don’t need to run bench update - just test to validate the effect of your code change. If no change then delete frappe-bench/apps/frappe/ frappe/utils/data.pyc and test again…

thank you Mr clarkej, the ‘only’ has been deleted.
by the way the cache is located to a directory under utils as a name _pycache_.
Next step is : i need to remove the currency symbol from in_words.

Good to hear - curiosity discipline and the q&a’s found on this forum will take you a long way…