Closed zorun closed 4 years ago
Apparently, the code XXX
is used to denoted "no currency": https://en.wikipedia.org/wiki/ISO_4217#X_currencies
To use this code, currency codes should probably be converted to a "human-friendly" string when choosing a currency in the list of currencies. Or at least an exception would have to be made for XXX
.
This seems to be the simple option, but comes with the need of a new feature, to translate the currency names.
Another simple fix would be to extend the size of the field ;-)
Note for later : we might want to rely on this lib for the translations : https://pypi.org/project/iso4217/
@indatwood after a loooong search, I discovered that Babel has everything we need:
I am currently working on this.
The currency is declared as a string of length 3:
However, an empty currency is encoded as the string
No Currency
, which is longer than 3 characters.Strangely enough, sqlite doesn't seem to care, and happily stores longer values:
But with postgresql, it is not even possible to apply the migration, because the default value is larger than the maximum length: