[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#123388
X-original-commit: 0d4b95e9d9d2218d6d9165f082e9f59d5025262d
Signed-off-by: Tiffany Chang <tic@odoo.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user