panosl / django-currencies

django-currencies allows you to define different currencies, and includes template tags/filters to allow easy conversion between them.
http://pypi.python.org/pypi/django-currencies
BSD 3-Clause "New" or "Revised" License
94 stars 81 forks source link

Rounding for currencies with no decimals (e.g. JPY) broken #57

Closed racitup closed 6 years ago

racitup commented 7 years ago

On review of utils.py it appears that the price_rounding function requires decimals >=2. Currencies such as JPY don't have a decimal (==0).

einarf commented 7 years ago

I added the possibility to use more than 2 decimals and set the previous hardcoded default (2) as a limitation because I was not comfortable with changing the old behaviour without adding unit test with a specific example.

Would this mean that currencies should also store their default rounding?

racitup commented 7 years ago

Very sensible! I've fixed this issue in the above PR. If you also look at my django-shop branch, the money types automatically use the exponent from the currency iso source stored in the info column.. so in a way they are already stored!

panosl commented 6 years ago

Merged and fixed.