[FIX] mrp: access BoM overview with dynamic variants

Steps to reproduce the bug:
- Create an attribute with "Variant Creation Mode" = Dynamically
- In a product template, add the attributes and some values
- Create a new BoM for this product
- Click on "Overview" smart button

Problem:
Traceback is triggered, because the `_match_all_variant_values` function
is called but without the product, while it takes at least one:

https://github.com/odoo/odoo/blob/7b7f65d5047731978d2d8bcbd8d77cfa86ac1d53/addons/mrp/models/mrp_routing.py#L95

https://github.com/odoo/odoo/blob/7b7f65d5047731978d2d8bcbd8d77cfa86ac1d53/addons/mrp/models/product.py#L209

As the variant creation mode is set to “dynamically”, we can skip the
get of operation line.

opw-3332902
opw-3329263

closes odoo/odoo#124015

X-original-commit: d8d312280aa041d5beee437c8192cb63050bfc40
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
This commit is contained in:
Touati Djamel (otd)
2023-06-09 12:21:50 +02:00
parent 10d0805c94
commit 2922b05ea2
@@ -353,7 +353,7 @@ class ReportBomStructure(models.AbstractModel):
company = bom.company_id or self.env.company
operation_index = 0
for operation in bom.operation_ids:
if operation._skip_operation_line(product):
if not product or operation._skip_operation_line(product):
continue
capacity = operation.workcenter_id._get_capacity(product)
operation_cycle = float_round(qty / capacity, precision_rounding=1, rounding_method='UP')