Skip to content
Snippets Groups Projects
Commit 0d4b95e9 authored by Mathias Mathy (MAMA)'s avatar Mathias Mathy (MAMA)
Browse files

[FIX] stock,mrp: Wrong forecasting on widget


**Summary :**
When using a great decimal precision, forecast_widget shows red
neverthless the available quantity is sufficient.

**Steps to reproduce :**
 - In Settings >> Technical >> Database Structure >> Decimal Accuracy
    - For usage __Product Unit of Measure__, set __Digits__ to **__6__**
 - Create products of type storable :
    - __Test Component__ with a __Qty on hand__ of **__76.6__** Units
    - __Test Product__
 - Create a BoM for __Test Product__, with Quantity set to **__1__** Units
    - Add component __Test Component__ with Quantity set to **__15.32__** Units
 - Create a MO for BoM __Test Product__ with a Quantity set to **__5__** Units
    - Confirm the MO.

**Before :**
Neverthless the __To Consume__ qty is set to 76.6, which is equal to the
__Qty on hand__ of the component, the forecast widget shows red as if
there's an insufficient quantity of the component

**After :**
With help of the Odoo's __formatFloat__ method, we round the data used
in the comparison defining the __willBeFulfilled__.
The forecast_widget now display properly, taking into account the digit
precision setup in the database.

opw-3281588

closes odoo/odoo#123074

Signed-off-by: default avatarTiffany Chang <tic@odoo.com>
parent f112e923
Branches
Tags
No related merge requests found
......@@ -24,7 +24,8 @@ export class ForecastWidgetField extends FloatField {
if (data.forecast_expected_date && data.date_deadline) {
this.forecastIsLate = data.forecast_expected_date > data.date_deadline;
}
this.willBeFulfilled = data.forecast_availability >= data.product_qty;
const digits = fields.forecast_availability.digits;
this.willBeFulfilled = parseFloat(formatFloat(data.forecast_availability, {"digits" : digits})) >= parseFloat(formatFloat(data.product_qty, {"digits" : digits}));
this.state = data.state;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment