From bd2a99b46959134ecde17728239c30dcd2a355ad Mon Sep 17 00:00:00 2001 From: clesgow Date: Thu, 23 Mar 2023 14:15:28 +0000 Subject: [PATCH] [FIX] mrp: use the right uom for replenish wizard When opened from the MO Overview, the uom in the wizard is the one from the product's form. The problem is that the quantity given to it is in the overview's line uom. So instead we add an already converted quantity to the `to_order` lines. Part of task-3217757 Part-of: odoo/odoo#118023 --- addons/mrp/report/mrp_report_mo_overview.py | 1 + .../src/components/mo_overview_line/mrp_mo_overview_line.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/mrp/report/mrp_report_mo_overview.py b/addons/mrp/report/mrp_report_mo_overview.py index e46f52e417f..68aa9595c07 100644 --- a/addons/mrp/report/mrp_report_mo_overview.py +++ b/addons/mrp/report/mrp_report_mo_overview.py @@ -310,6 +310,7 @@ class ReportMoOverview(models.AbstractModel): 'product_model': product._name, 'product_id': product.id, 'quantity': missing_quantity, + 'replenish_quantity': move_raw.product_uom._compute_quantity(missing_quantity, product.uom_id), 'uom_name': move_raw.product_uom.display_name, 'uom_precision': self._get_uom_precision(move_raw.product_uom.rounding), 'product_cost': currency.round(product.standard_price * move_raw.product_uom._compute_quantity(missing_quantity, product.uom_id)), diff --git a/addons/mrp/static/src/components/mo_overview_line/mrp_mo_overview_line.js b/addons/mrp/static/src/components/mo_overview_line/mrp_mo_overview_line.js index d4dd519e52c..994d7a27359 100644 --- a/addons/mrp/static/src/components/mo_overview_line/mrp_mo_overview_line.js +++ b/addons/mrp/static/src/components/mo_overview_line/mrp_mo_overview_line.js @@ -48,7 +48,7 @@ export class MoOverviewLine extends Component { async openReplenish() { return this.actionService.doAction("stock.action_product_replenish", { - additionalContext: { default_product_id: this.data.product_id, default_quantity: this.data.quantity }, + additionalContext: { default_product_id: this.data.product_id, default_quantity: this.data.replenish_quantity || this.data.quantity }, onClose: (closeInfo) => { if (closeInfo?.done) { // Trigger the reload only if a replenishment was done. @@ -138,6 +138,7 @@ MoOverviewLine.props = { state: { type: String, optional: true }, formatted_state: { type: String, optional: true }, quantity: Number, + replenish_quantity: { type: Number, optional: true }, quantity_decorator: { type: [String, Boolean], optional: true }, uom_name: { type: String, optional: true }, uom_precision: { type: Number, optional: true },