Home > Mobile >  Odoo currency rounding with too many decimals
Odoo currency rounding with too many decimals

Time:09-28

I am trying to convert one currency float to another, but for some reason the resulting number (even though it is correct) has too many decimals.

I am converting EUR float 36.75 (currency decimal rounding = 0.01) into CZK float (currency decimal rounding = 0.01)

Example

eur_currency._convert(36.75, move.company_currency_id, move.company_id, move.date)

result = 942.3100000000001

desired output = 942.31

CodePudding user response:

You can use round:

round(result, 2)
  • Related