Error: Quantity (25.000001) cannot be a fraction in row 1

There is no reason for this to be happening that makes any sense. No fractions are used in our system. Also, how the h would it get a quantity of 25.000001 ???
This is happening when we try to save a production order using all whole quantities, all unit measurements.
Very frustrating

This is the “row 1” it is referring to

@H_N helped me with a similar problem… his recommendation is here

Hi @Solivety,

Have tried with keeping type as ‘float’ for qty field through customise form.?

1 Like

Ok so unchecking “must be a whole number” on the UOM for “unit” solved this…but this doesn’t make sense and so I would like to continue this exploration a bit because:
–Isn’t the point of even having a “must be a whole number” checkbox specifically for things like “unit” (in this case coconuts) which will NEVER be less or more than a coconut?

What you observed versus what you expected can be explained!

Your case is a result of how ERPNext stores and manages numeric values: In the case of whole number (or integer) values and real number (of floating point) values, in either case quantity values are apparently all stored as a Python class float.

To confirm this, in the Setup module open a Customize DocType on Item and you will see numeric values Opening Stock Minimum Order Qty and so on are of Float type.

What you happened on is a case of representation error
14. Floating Point Arithmetic: Issues and Limitations — Python 2.7.18 documentation

This function aims to identify such problems validate_uom_is_integer

Here are other references that may help

1 Like

Ok, I’m just tentatively awakening my code mind so I will study this further… So this is not really an error and yet it appears… So it seems then it is an error of omission(meaning just hasn’t been done yet) of the code that would truncate inappropriate float ?
I mean wouldn’t this be the equivalent of a simple If/then statement… If quantity = (float) then truncate decimal ? (excuse the non-code code haha but you get the idea?)
Or am I missing something…
Just seems a simple fix, it’s disconcerting for the non-coding user who is focused on his business bottomline to see a quantity of 25.000001 etc… this is the type of thing that marginalizes ERPNext in my view…
I look forward to being able to offer some of these solutions myself soon, but I’ve got a steep curve to deal with in the meantime just trying to get it usable :slight_smile: