In this blog we will explain how we can make rounding in odoo for float numbers
as we know 10/3 = 3.333333333333X , and we can make rounding for this value as 3.34 or 3.334 or 3.33 or 3.3 or 3.333 , that is means we have more than one way to make rounding in math , so how can we make rounding in odoo ?
To make rounding in odoo we can use round() function id takes 2 arguments the first one it the float number that we want to round it ,and the second one is the number of rounding index so the Rule as
num = round(float_number,index_number)
so if we want to round 10/3 for 2 index with will be 3.34 we can do it as bellow
num = round(10/3,2)
Another way to make rounding in odoo is by using float_round() function with can takes 4 arguments as bellow
num = float_round(10/3,precision_digits=2, precision_rounding=None, precision_method='up' )
No comments:
Post a Comment