-
- Downloads
[FIX] {purchase_,sale_}stock, stock: round qty in report
Due to floating point limitation, the quantities displayed in the
forecasted report should be formatted to ensure the rounding.
Issue example:
(Need stock)
1. Create a storable product P
2. Update its quantity to 7.1
3. Consult the Forecasted Report
Error:
Quantities are "7.1000000000000005 Units". In this case, the
floating-point issue comes from the method `float_round()`
Another example:
(Need purchase_stock)
1. Create a storable product P
2. Update its quantity to 0.1
3. Create a PO with 0.2 x P
4. Consult the Forecasted Report
Error:
The "Forecasted + Pending" quantity is 0.30000000000000004 Units. This
field is directly computed while rendering the report, it's the sum of
0.1 and 0.2 which, in python, results in 0.30000000000000004
(floating-point issue)
Since the rounding of these quantities are actually based on the decimal
precision of the UoM, this commit may slightly change the report.
Suppose the generic precision is .001 and the precision of "Units" is
0.01: if the quantity is 12.34, one zero will be added in the report:
12.340. However, these unnecessary zeros do not change the information
that is initially displayed. Moreover, the UoM precision can not be
greater than the generic precision, so we will never lose a part of the
quantity to display.
OPW-2611892
closes odoo/odoo#78773
Signed-off-by:
William Henrotin <Whenrow@users.noreply.github.com>
Showing
- addons/purchase_stock/report/report_stock_forecasted.xml 1 addition, 1 deletionaddons/purchase_stock/report/report_stock_forecasted.xml
- addons/sale_stock/report/report_stock_forecasted.xml 1 addition, 1 deletionaddons/sale_stock/report/report_stock_forecasted.xml
- addons/stock/report/report_stock_forecasted.xml 7 additions, 7 deletionsaddons/stock/report/report_stock_forecasted.xml
Please register or sign in to comment