Steps to reproduce the bug:
- Create a storable product “P1” with BOM:
- Type: Kit
- Quantity: 3
- Components:
- product “C1”, QTY: 5
- Update the quantity of “C1” to have 10 in stock
- Go to “P1” product form
Problem:
- The on-hand quantity is 2 instead of 6 →
10 (available qty of c1) / (5 / 3) = 6
In the `_compute_quantities_dict` function, the `explode` function is
called to have the qty of the component necessary:
https://github.com/odoo/odoo/blob/ef4ae7f62d6b690b4745b4145ce25ff02b6b29f6/addons/mrp/models/product.py#L151
but it is the qty necessary for 3 kit according to what is indicated
in the BOM, so we will have 5 qty needed of “C1” as a result:
https://github.com/odoo/odoo/blob/49234be3418169c8f3c928493b86a1a67ab55914/addons/mrp/models/mrp_bom.py#L289
Then the quantity available in stock of the “C1” (10) is reduced by
the quantity needed (5), so 2:
https://github.com/odoo/odoo/blob/ef4ae7f62d6b690b4745b4145ce25ff02b6b29f6/addons/mrp/models/product.py#L188
But this result must be multiplied at
the end by the quantity set in the BOM (3), to get the quantity per kit
→ (10/5)* 3 = 6
opw-3010175
closes odoo/odoo#103584
X-original-commit: 8ede8a758a92c4b61fe48d820464783e21ee7847
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
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.