Improve default currency digits

Rational

The currency module provides the import_currencies.py script to import currencies. The script uses pycountry which in turn relies on https://salsa.debian.org/iso-codes-team/iso-codes

However, that database does not contain the number of decimal digits which is available in ISO 4217. Tryton defaults to 2 digits which is ok for most currencies but not all of them.

Proposal

I’d like to improve this situation so that the currency digits are properly set by import_currencies.py.

Implementation

ISO provides a publicly available list in XML but that database does not provide translations which are available in pycountry.

So the idea is to modify import_currencies.py to download list_one.xml and pick the number of digits from this file while keeping the rest of the script unchanged.

Opinions?

I do not see any reason to do not include the default digits of the currencies but we should contribute first to pycountry to make them include this data and then update our script to load the currencies.

I see the iso4217 database is part of pycountry but it does not include the digits. So probably there is something to be updated on their side.

1 Like

I think it can be done by reviving this https://salsa.debian.org/iso-codes-team/iso-codes/-/issues/3

Thanks for pointing out.

I just added a comment, let’s see if they make some kind of decision on whether they want that feature or not.

1 Like