How to use frappe.utils.money_in_words

I want to have the amount displayed both in words and in number. I have searched but am not getting something which is clear. Help please!

When in doubt, look at the existing code for hints:

I have tried this code but not getting the amount in word! would you help me to resolve the issue?

Can you share what you tried?

Here’s an example:

In print format, enter the following in HTML:

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

This will reflect on your print format as follows:

1 Like

I want to do this in custom script or in material_request.py file to show the in word in the form view. I have tried the following in the .py file

def set_total_in_words (self):

from frappe.utils import money_in_words

from erpnext.setup.utils import get_company_currency

if self.company:

    company_currency = get_company_currency(self.company)

    self.in_word = money_in_words(self.total, company_currency)

here in_word is the field where i want to show the in word of the total field.

For money_in_words both js and php script are required. I have solved my problem. thanks the forum members who tried to give solution! Because from one post from one of the forum members gave me the idea!

1 Like

Hey there,
I want to show the Final price in word on my Order form,

Could you please let me know how can I do that?

I made the extra field name final price str and set the JS code,
It is needed to have both server and client scripts at the same time?

It would be great if you could help me to complete.

Server Script:
doc.final_price_str = frappe.utils.money_in_words(doc.final_price,‘IRR’);

Client Script:
final_price_str =frappe.utils.money_in_words(final_price,‘IRR’);
frm.set_value(“final_price_str”,final_price_str);

frappe.utils.money_in_words
I tried this but it also shows commas in words for example
Two thousand, five hundred

Try with “frappe.utils.in_words”… not “frappe.utils.money_in_words”.

No, it does not work same comma is coming