From e2d89d0b94ffc52a1e08593d268e882e370aa3b4 Mon Sep 17 00:00:00 2001 From: "Touati Djamel (otd)" Date: Fri, 26 Nov 2021 08:07:01 +0000 Subject: [PATCH] [FIX] mrp: fix the qty in the BOM report Steps to reproduce the bug: - Create a BOM: - Set the quantity of the finished product and component as more than 1 - Save > Go to BOM Structure & Cost > the quantity in the input is set on 3 - Print Problem: The report generated shows the qty and cost for production of 1 unit of product, regardless of the BOM quantity set in the input The "_onClickPrint" function tries to get the quantity of the bom in the context, but since the value of "this.given_context.searchQty" is null, the function will use the default value of 1. The "searchQty" is only set in the "onchange", so we can manually trigger it when initiating the page so that the "searchQty" is set correctly opw-2691632 closes odoo/odoo#80524 X-original-commit: dcd3de94f708425ca06527483cf30e21077caab0 Signed-off-by: William Henrotin (whe) Signed-off-by: Djamel Touati (otd) --- addons/mrp/static/src/js/mrp_bom_report.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/mrp/static/src/js/mrp_bom_report.js b/addons/mrp/static/src/js/mrp_bom_report.js index 51a23977022..46654d8aec4 100644 --- a/addons/mrp/static/src/js/mrp_bom_report.js +++ b/addons/mrp/static/src/js/mrp_bom_report.js @@ -137,8 +137,8 @@ var MrpBomReport = stock_report_generic.extend({ this.$buttonPrint.find('.o_mrp_bom_print_all_variants').on('click', this._onClickPrint.bind(this)); this.$buttonPrint.find('.o_mrp_bom_print_unfolded').on('click', this._onClickPrint.bind(this)); this.$searchView = $(QWeb.render('mrp.report_bom_search', _.omit(this.data, 'lines'))); - this.$searchView.find('.o_mrp_bom_report_qty').on('change', this._onChangeQty.bind(this)); - this.$searchView.find('.o_mrp_bom_report_variants').on('change', this._onChangeVariants.bind(this)); + this.$searchView.find('.o_mrp_bom_report_qty').on('change', this._onChangeQty.bind(this)).change(); + this.$searchView.find('.o_mrp_bom_report_variants').on('change', this._onChangeVariants.bind(this)).change(); this.$searchView.find('.o_mrp_bom_report_type').on('change', this._onChangeType.bind(this)); }, _onClickPrint: function (ev) {