-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Qty to ship and Qty to invoice are handling decimals poorly #14328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
#distributed-cd |
I am uncertain at the moment if I should go with a simple round() I'll probably do that but use a larger than usual precision (like 8 decimals) which should prove enough to deal with extremely small decimal numbers |
@barbazul rounding is not a good idea in general as error can accumulate. What should be really avoided is strict comparisons of float.
Looks like somewhere in Magento there is a check |
@orlangur That would require a much larger change. Becase both getSimpleQtyToShip and getQtyToInvoice are being in several places. Changing each of the comparissions would hide the underlying problem and is not future proof as some new functionality might use those public methods and repeat the error |
Hi @barbazul. Thank you for your report.
The fix will be available with the upcoming 2.3.0 release. |
Is the fix available so we can fix this for M2.2.3? |
It should be relatively simple to build a module with plugins for the 2 affected methods. Just check the committed code. |
@barbazul, thank you for your report. |
Hey @Top-CMS finally got around to building a module out of this: https://github.com/SemExpert/SemExpert_FixSalesDecimals Enjoy |
Hi @TomashKhamlai. Thank you for working on this issue.
|
The issue was re-tested and we can confirm that it was fixed on the 2.3 release branch. We closing this issue as fixed due to upcoming 2.3 release that will be available soon. |
When working with products set up with is_qty_decimal, getQtyToShip and getQtyToInvoice sometimes return wrong values and cause orders to not be able to be completed
Preconditions
Steps to reproduce
Expected result
Actual result
Overall float point numbers are handled poorly in all order qty operations
The text was updated successfully, but these errors were encountered: