diff --git a/addons/mrp/static/src/mrp_forecasted/forecasted_buttons.js b/addons/mrp/static/src/mrp_forecasted/forecasted_buttons.js index 25417bcfa8a16f96cb01901a50c5496224c6abf6..ed563727962985195abd7afd74e1c0da56722cce 100644 --- a/addons/mrp/static/src/mrp_forecasted/forecasted_buttons.js +++ b/addons/mrp/static/src/mrp_forecasted/forecasted_buttons.js @@ -8,8 +8,9 @@ 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', 'variant_bom_ids']}))[0]; - this.bomId = res.variant_bom_ids[0] || res.bom_ids[0]; + const fields = this.resModel === "product.template" ? ['bom_ids'] : ['bom_ids', 'variant_bom_ids']; + const res = (await this.orm.call(this.resModel, 'read', [this.productId], { fields }))[0]; + this.bomId = res.variant_bom_ids ? res.variant_bom_ids[0] || res.bom_ids[0] : res.bom_ids[0]; }); },