Go to file
2026-02-10 23:44:21 +07:00
models feat: Enforce manual consumption and picked flags on stock move quantity write and update consumption bypass conditions. 2026-02-10 23:44:21 +07:00
__init__.py first commit 2026-02-06 18:05:38 +07:00
__manifest__.py first commit 2026-02-06 18:05:38 +07:00
.gitignore first commit 2026-02-06 18:05:38 +07:00
README.md feat: Enforce manual consumption and picked flags on stock move quantity write and update consumption bypass conditions. 2026-02-10 23:44:21 +07:00

MO Lock Consumed

This Odoo module customizes the behavior of Manufacturing Orders (MO) regarding ingredient consumption and validation.

Features

  1. Lock Consumed Quantity:

    • Prevents the automatic update of a component's "Consumed" quantity when the MO's "Quantity to Produce" is changed, IF:

      • The component already has a manually entered "Consumed" quantity (greater than 0).
      • The component is marked as Picked (manual consumption) or has Manual Consumption flag set.
    • If a component has 0 consumed quantity and is not picked, it will continue to scale automatically based on the BOM ratio (standard behavior).

  2. Safety Check for Negative Stock:

    • Hides the "Produce" and "Produce All" buttons if proceeding with the production would cause the potential stock of any component to drop below zero (negative stock).
    • Exception: If a component's "Consumed" quantity is explicitly set to 0 (e.g., for custom productions where a BOM component is not used), it is skipped in this check, allowing production to proceed.

Usage

  • Standard Flow: Create an MO, confirm it. The behavior remains standard unless you manually intervene.
  • Custom Consumption: If you manually set a component's consumed quantity (e.g., to 5 units), changing the global "Quantity to Produce" will not override your manual entry of 5 units.
  • Stock Validation: If you try to produce a quantity that requires more components than you have in stock, the Produce buttons will disappear, preventing you from accidentally forcing negative stock. To fix this, either replenish stock or adjust the consumed quantity to 0 (if omitting the component).