[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:
@@ -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 },
|
||||
|
||||
Reference in New Issue
Block a user