Reputation: 85
I am using Odoo 10 and I cant figure out how to stop a custom float field rounding.
Here is my field box = fields.Float("Yards Per Box")
In Odoo if I put 1.196 into the field it auto rounds to 1.20 how can I stop this on a custom Float field?
Upvotes: 0
Views: 6203
Reputation: 85
None of the suggested answers worked. I got it working by using dp.get_precision
here is an example
cost_price = fields.Float(
'Book Cost', dp.get_precision('Book Price'))
Then setting Book Price in deciaml accuracy under technical to 3
This is a better way of doing it than hard coding as I can change the decimals to any figure from Odoo GUI under Technical | Database Structure | Decimal Accuracy
Upvotes: 2
Reputation: 84
Try this,
box = fields.Float("Yards Per Box", digits=3)
if you want to add 3 digit precision...
Upvotes: -1