Skip to content

[16.0] mrp_multi_level: Missing demand propagation for subcontracting BOMs #1477

@marco-lucaf

Description

@marco-lucaf

Module

mrp_multi_level

Describe the bug

The MRP calculation doesn't propagate demand through subcontracting BOMs. When a product has a subcontracting BOM and is set as "buy" for procurement, the system creates planned purchase orders but doesn't generate demand for its components.

For example:

  • Product A (subcontracted, procurement: buy) contains Product B
  • When there's demand for Product A, the system creates planned purchase order for Product A
  • However, no demand is propagated to Product B and no MRP movements are created for components

To Reproduce

Affected versions:

  • Odoo 16.0
  • mrp_multi_level OCA module

Steps to reproduce the behavior:

  1. Create Product A and set its procurement method as 'buy'
  2. Create a BOM for Product A and set its type as 'subcontract'
  3. Add Product B as component in Product A's BOM
  4. Create some demand for Product A (e.g., through a sale order)
  5. Run MRP calculation
  6. Check MRP movements and planned orders

Expected behavior
When running MRP calculation:

  1. System should create planned purchase orders for Product A
  2. System should propagate demand to Product B
  3. MRP movements should be created for all components in the subcontracting BOM

Additional context
Technical analysis shows the issue is in the _explode_bom_mrp method which currently only processes BOMs for products with 'manufacture' supply method. It should also handle products with subcontracting BOMs, even if their supply method is 'buy'.

The bug affects the basic functionality of MRP planning for subcontracted products, which is a common manufacturing scenario.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions