[FIX] mrp: clean bom overview report

Does 2 things:
- ensure that the "free_qty" doesn't display a negative value (=>
  consistent with MO overview + avoids neg "Ready to Produce" values)
- ensure that showOptions.availabilities is always a Boolean and never
  "undefined" (=> avoid traceback when opening overview while in debug
  mode)

closes odoo/odoo#140767

Signed-off-by: Quentin Wolfs (quwo) <quwo@odoo.com>
This commit is contained in:
Tiffany Chang (tic)
2023-11-04 00:38:33 +00:00
parent 79ab83e732
commit ef75711fb2
2 changed files with 2 additions and 2 deletions
@@ -380,7 +380,7 @@ class ReportBomStructure(models.AbstractModel):
@api.model
def _get_quantities_info(self, product, bom_uom, product_info, parent_bom=False, parent_product=False):
return {
'free_qty': product.uom_id._compute_quantity(product.free_qty, bom_uom) if product.detailed_type == 'product' else False,
'free_qty': max(product.uom_id._compute_quantity(product.free_qty, bom_uom), 0) if product.detailed_type == 'product' else False,
'on_hand_qty': product.uom_id._compute_quantity(product.qty_available, bom_uom) if product.detailed_type == 'product' else False,
'stock_loc': 'in_stock',
}
@@ -21,7 +21,7 @@ export class BomOverviewComponent extends Component {
this.state = useState({
showOptions: {
uom: false,
availabilities: false || this.props.action.context.activate_availabilities,
availabilities: false || Boolean(this.props.action.context.activate_availabilities),
costs: true,
operations: true,
leadTimes: true,