How to check if float number is zero

If you need to check if a float value is equal to zero it is recommended to use the method float_is_zero. This method accepts float value as required argument and two additional arguments: “precision_digits” and “precision_rounding”. Important thing is that precision must be given by “precision_digits” or “precision_rounding“, not both. It returns True if the given value is 0 at the given precision.

More about this method you can find into the Odoo repository.

Share the knowledge!

Leave a Reply

Your email address will not be published. Required fields are marked *