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

https://docs.python.org/2/library/functions.html#float

https://docs.python.org/2/library/fractions.html

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: