How to change currency formatting?

What I want to do:
Change display (and print) format symbol-space-amount (e.g. $ 10) into amount-space-currency ISO code (e.g. 10 USD) in all fields of type “currency”.

Why I want to do that:
In Poland we don’t use “zł 10”, like in ERPNext, but “10 PLN”, because:

  • We use currency ISO code after value, not symbol before value, so “zł 10” looks foolish (and “PLN 10” looks foolish, too).
  • PLN is better, because there was “old” polish zloty (PLZ), also called “zł”. So “zł” can mean PLN or PLZ, and 1 PLN = 10 000 PLZ. I could edit “zł” into “PLN”, but PLN 10 still looks foolish.
  • ISO codes (like PLN, USD, EUR, etc.) are commonly used in Poland, and always after amount.
  • Symbols like €, $, etc. are almost not used, and if are used, are usually printed after amount (e.g. 10 €).

What I tried to do:

  • change return value of format_currency in frappe/frappe/public/js/frappe/utils/number_format.js
  • change return value of fmt_money in frappe/frappe/utils/data.py
    But nothing changed after restarting the server, bench clear-cache, etc. It had no effect.

I even started making custom print format, without “currency” type fields, with currency (ISO code) in separate column and it worked. But there is a lot of printable document types, so making custom print format for every document type is not good solution. And there are still other places, like report view, with currency symbols, in which simple “hide symbol” option will confuse the users (“Is this in PLN? Or in EUR?”).

So my question is:
What should I change in the source code of Frappe or ERPNext and what else should I do to change the display format of “currency” type fields?

I solved it myself.

The solution:
After making changes, you have to run in terminal:
bench build

Files to modify were correct:

  • /frappe-bench/apps/frappe/frappe/utils/data.py
  • /frappe-bench/apps/frappe/frappe/public/js/frappe/utils/number_format.js

In data.py I changed fmt_money. I simply replaced this (just before “return”):
amount = symbol + " " + amount
with this:
amount = amount + " " + currency

In number_format.js I modified format_currency to return this:
format_number(v, format, decimals) + " " + currency;

The changes will be lost after bench update, so I will have to make them again, but I don’t know how to contribute to the core of ERPNext, yet.

can you share your 2 files i change but its not working did bench update

Look here: