From 5e54ac4ecc2057808074bf3c94a6a29a5c129c84 Mon Sep 17 00:00:00 2001 From: "Walid HANNICHE (waha)" Date: Wed, 22 Mar 2023 13:02:33 +0000 Subject: [PATCH] [FIX] stock: refresh forecast page Steps to reproduce: 1. Inventory / Configuration / Warehouse Management / Warehouses 2. Need at least 2 warehouses 3. Inventory / Products / Products 4. Click forecasted quantity on a product that has some on hand 5. Click warehouse and select any option 6. Refresh the page 7. Error Bug: when refreshing the page the context gets cleared and productID lost which leads to an error when looking for its bomIDS Fix: when refreshing the page get the productID from the url also set the default title to "Forcasted Report" opw-3217987 closes odoo/odoo#116198 X-original-commit: d49c73f95033472f1417ee05793d5f100f641dd0 Signed-off-by: William Henrotin (whe) Signed-off-by: Walid Hanniche (waha) --- .../stock/static/src/stock_forecasted/stock_forecasted.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/stock/static/src/stock_forecasted/stock_forecasted.js b/addons/stock/static/src/stock_forecasted/stock_forecasted.js index 6a8d0b307b8..7eed0c255f5 100644 --- a/addons/stock/static/src/stock_forecasted/stock_forecasted.js +++ b/addons/stock/static/src/stock_forecasted/stock_forecasted.js @@ -1,6 +1,7 @@ /** @odoo-module **/ import { useService } from "@web/core/utils/hooks"; +import { _t } from "@web/core/l10n/translation"; import { registry } from "@web/core/registry"; import { View } from "@web/views/view"; import { ControlPanel } from "@web/search/control_panel/control_panel"; @@ -20,7 +21,11 @@ export class StockForecasted extends Component { this.context = useState(this.props.action.context); this.productId = this.context.active_id; this.resModel = this.context.active_model; - this.title = this.props.action.name; + this.title = this.props.action.name || _t("Forecasted Report"); + if(!this.context.active_id){ + this.context.active_id = this.props.action.params.active_id; + this.reloadReport(); + } onWillStart(this._getReportValues); }