From 1b02516d125865a9fea7be1cf35d78bd6fc14e29 Mon Sep 17 00:00:00 2001 From: "Touati Djamel (otd)" Date: Thu, 9 Mar 2023 10:16:49 +0000 Subject: [PATCH] [FIX] mrp: display the BoM overview of the current product variant MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Stpes to reproduce the bug: - Create a storable product “P1” with 2 variants: - Color: Red and blue in this order - Create a BoM for each variant - Create a SO: - select the product “P1 - blue” → the second variant - Click on the forecast button → manufacturing forecast Problem: The BoM overview is showing the wrong product variation because it pulls the default BoM of the base product (always the first variant from the list) opw-3166074 closes odoo/odoo#115421 X-original-commit: 873d6d921c3955b707d10826a898ae405f296531 Signed-off-by: Djamel Touati (otd) --- addons/mrp/static/src/mrp_forecasted/forecasted_buttons.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/mrp/static/src/mrp_forecasted/forecasted_buttons.js b/addons/mrp/static/src/mrp_forecasted/forecasted_buttons.js index 7548e48cc20..25417bcfa8a 100644 --- a/addons/mrp/static/src/mrp_forecasted/forecasted_buttons.js +++ b/addons/mrp/static/src/mrp_forecasted/forecasted_buttons.js @@ -8,8 +8,8 @@ patch(ForecastedButtons.prototype, 'mrp.ForecastedButtons',{ setup() { this._super.apply(); onWillStart(async () =>{ - const res = await this.orm.call(this.resModel, 'read', [this.productId], {fields: ['bom_ids']}); - this.bomId = res[0].bom_ids && res[0].bom_ids[0]; + const res = (await this.orm.call(this.resModel, 'read', [this.productId], {fields: ['bom_ids', 'variant_bom_ids']}))[0]; + this.bomId = res.variant_bom_ids[0] || res.bom_ids[0]; }); },