Files
odoo_source/addons/mrp
William Henrotin c1ff654875 [FIX] mrp: print “BOM structure & cost” 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 "Stucture&Cost" smart button

Problem:
A traceback is raise, 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/15.0/addons/mrp/models/mrp_bom.py# L456
https://github.com/odoo/odoo/blob/15.0/addons/mrp/models/product.py#L286

As the variant creation mode is set “dynamically”, the object must be a
`product.template` model and not `product.product` so the first
condition should be `True` and return a `false` value:
https://github.com/odoo/odoo/blob/5c16aa22c70f8a0a377a55b912307ab07222c643/addons/mrp/models/mrp_bom.py#L453-L454

Therefore, if the product has no variant, we have to use the
`product_template` and set it in the `_get_bom` function, but from this
commit:
odoo@ca3dfec

If there is no variant product, the template is no longer set:
odoo@ca3dfec#diff-e8f576a790cd7f3f0976358b9b07f63cee0c6f05b0ba6203fc7bcf91af3ad283L107

The change in this commit from line 107 to line 118 is useless because
it does not change any behavior and does not improve the code, the only
change is that the product_template is no longer set. So it makes sense
to revert this part of change

opw-3008838

closes odoo/odoo#110341

X-original-commit: 1d830b5080e4d05dc1ac6fbd4c435af532443f88
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2023-01-19 12:31:03 +01:00
..
…
…

Odoo Manufacturing Resource Planning

Manage Bill of Materials, plan manufacturing orders, track work orders with the Odoo Open Source MRP app.

Get all your assembly or manufacturing operations managed by Odoo. Schedule manufacturing orders and work orders automatically. Review the proposed planning with the smart kanban and gantt views. Use the advanced analytics features to detect bottleneck in resources capacities and inventory locations.

Schedule Manufacturing Orders Efficiently

Get manufacturing orders and work orders scheduled automatically based on your procurement rules, quantities forecasted and dependent demand (demand for this part based on another part consuming it).

Define Flexible Master Data

Get the flexibility to create multi-level bill of materials, optional routing, version changes and phantom bill of materials. You can use BoM for kits or for manufacturing orders.

Get Flexibility In All Operations

Edit manually all proposed operations at any level of the progress. With Odoo, you will not be frustrated by a rigid system.

Schedule Work Orders

Check resources capacities and fix bottlenecks. Define routings and plan the working time and capacity of your resources. Quickly identify resource requirements and bottlenecks to ensure your production meets your delivery schedule dates.

A Productive User Interface

Organize manufacturing orders and work orders the way you like it. Process next orders from the list view, control in the calendar view and edit the proposed schedule in the Gantt view.

Inventory & Manufacturing Analytics

Track the evolution of the stock value, according to the level of manufacturing activities as they progress in the transformation process.

Fully Integrated with Operations

Get your manufacturing resource planning accurate with it's full integration with sales and purchases apps. The accounting integration allows real time accounting valuation and deeper reporting on costs and revenues on your manufacturing operations.