Change Currency Docfield Symbol

What’s the best way to change a currency docfields currency symbol? From $ to ₹, USD to INR, for example?

I’m using format_currency and then refreshing the field but I can’t trigger a change in the symbol, when I log the output it shows “₹ 100.00”. I cant find an obvious way to do it in set_df_property which seemed like another logical place to look.

Hi,

Maybe you can get some hints here:

EDIT:

For Example:

frm.set_currency_labels(['total'], 'USD')

OK. So this is part of the solution (and a part I forgotten about, so I glad you pointed me to it) but it’s not changing the symbol, just the label. In the console:

cur_frm.set_currency_labels(["amount_due"], "INR")
image
cur_frm.set_currency_labels(["amount_due"], "USD")
image

The currency symbol remains $ but the label changes.

1 Like

The currency fieldtype can be dynamic based on Options in the field’s meta.

You can create a link field for Currency doctype and set that field’s name as “options” for the field whose symbol you want to change. (See Sales Order doctype for example)

Then you can have the label changed and dependent field refreshed on change of link field.

2 Likes

Yes! That worked. Thank you @snv

1 Like

Hello @tmatteson

Can you please the script that you used to accomplish this?
I need to set the symbol for the currency field (it will be dependent on another selection), so how I can obtain this?

Regards
Bilal

Hello @tmatteson
Can you please help?

Regards
Bilal

I can’t find where I’m doing it in the code that I wrote. I know that I have not been able to change it in a child table at all.

What this thing that worked?

Regards
Bilal

Continued here How to show currency Symbol inside the field - #13 by bghayad

This part of the puzzle helps

Hello;

How I can use set_currency_labels for child table field?

Regards
Bilala

1 Like

frappe.model.set_currency_labels(cdt, cdn, "amount", "USD);

Try this one

Woah. I had to read this like 5 times to understand it.

What @snv is saying is very straight-forward:

  1. Create a link type field in your doctype linked to Currency (doctype)

  2. Create your currency field

  3. Put field 1 as the option in field 2

Field 2 will automatically get its symbol when field 1 changes

4 Likes

We can also specify the currency symbol in the options something like “company.default_currency”.

1 Like

I tried all the suggested solutions here but couldn’t manage to change the currency symbol used in a query report. How can I adjust the currency (in a multi-currency setup) to a different currency than the standard currency? I used Currency as field type and the field is correctly displayed as a currency. However, I cannot adjust the symbol to display a different symbol from the default currency. What am I missing?

In a report you need a column for the currency. For example, the P&L report returns a currency column but it’s hidden from the user.

Thanks @tmatteson. I tried this (following @adam26d suggestion) but I don’t see any enabled currencies in the query report. Is it somehow different for query reports than for changing in standard doctypes (I think that was the original question here)?
This is from the report:


Is it maybe that the “Options” field in a doctype is different from the options in a query report?