We are trying to implement OpenERP's function "amount_to_text" for total amount in our reports, but have a problem when the odoo interprets an amount like 20.38 as TWENTY DOLLARS AND THREE THOUSAND EIGHT HUNDRED CENTS, since the prices are with 4 decimal places, like 0.0640.
How can we have the function "amount_to_text" to return the correct text for the amount, or How can we round up only the total sum to 2 decimal places in order for the "amount_to_text" to run correctly?
Thx in advance!
I've tried to setting the rounding precision to 0.01, but it rounds up all prices in the DB.
The method
amount_to_textof theres.currencymodel reformat your value according to the currencydecimal_placesfield value, which it's a computed field that depends on theroundingfield to calculate the number of decimal places that will be taken into account to return the text representation of the amount.So you have this 3 options(could be more):
But this will affect all of the next conversion operations if the value it's not restored back to what it was
And use it like: text = currency.with_context(decimal_places=2).amount_to_text(20.38)