[FIX] mrp: avoid negative free quantities on MO Overview
When more than available quantities are already consumed for a product, a negative quantity will be displayed as `free to use` quantity, which doesn't make much sense. Part-of: odoo/odoo#114536
This commit is contained in:
@@ -176,7 +176,7 @@ class ReportMoOverview(models.AbstractModel):
|
||||
'quantity': production.product_qty if production.state != 'done' else production.qty_produced,
|
||||
'uom_name': production.product_uom_id.display_name,
|
||||
'uom_precision': self._get_uom_precision(production.product_uom_id.rounding),
|
||||
'quantity_free': product.uom_id._compute_quantity(product.free_qty, production.product_uom_id) if product.type == 'product' else False,
|
||||
'quantity_free': product.uom_id._compute_quantity(max(product.free_qty, 0), production.product_uom_id) if product.type == 'product' else False,
|
||||
'quantity_on_hand': product.uom_id._compute_quantity(product.qty_available, production.product_uom_id) if product.type == 'product' else False,
|
||||
'quantity_reserved': 0.0,
|
||||
'receipt': self._check_planned_start(production.date_deadline, self._get_replenishment_receipt(production, components)),
|
||||
@@ -435,7 +435,7 @@ class ReportMoOverview(models.AbstractModel):
|
||||
'quantity': quantity,
|
||||
'uom_name': move_raw.product_uom.display_name,
|
||||
'uom_precision': self._get_uom_precision(move_raw.product_uom.rounding),
|
||||
'quantity_free': product.uom_id._compute_quantity(product.free_qty, move_raw.product_uom) if product.type == 'product' else False,
|
||||
'quantity_free': product.uom_id._compute_quantity(max(product.free_qty, 0), move_raw.product_uom) if product.type == 'product' else False,
|
||||
'quantity_on_hand': product.uom_id._compute_quantity(product.qty_available, move_raw.product_uom) if product.type == 'product' else False,
|
||||
'quantity_reserved': self._get_reserved_qty(move_raw, production.warehouse_id, replenish_data),
|
||||
'receipt': self._check_planned_start(production.date_start, self._get_component_receipt(product, move_raw, production.warehouse_id, replenishments, replenish_data)),
|
||||
|
||||
Reference in New Issue
Block a user