[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
This commit is contained in:
clesgow
2023-04-13 15:26:42 +02:00
parent a145830b34
commit bd2a99b469
2 changed files with 3 additions and 1 deletions
@@ -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)),
@@ -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 },