A requirement is the starting point of every material movement in Sistema MRP. It captures which materials are needed at a specific obra warehouse, how many units are requested, and which project (budget) the consumption belongs to. As soon as a requirement is saved, the system attempts to reserve stock from the principal warehouse for each item.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ElthonJohan/Sistema-MRP/llms.txt
Use this file to discover all available pages before exploring further.
Creating a requirement
Selecting a project is mandatory.
create_requirement() returns (False, "Debes seleccionar un proyecto. El proyecto es obligatorio.") if budget_id is not provided. The project must also exist and be active.Open the Requirements page
Navigate to Requerimientos in the sidebar. You need at least one obra warehouse, one principal warehouse, at least one material with stock in the principal warehouse, and one active project before the creation form is shown.
Select the project
Choose the active project (Proyecto *). This links the requirement to a budget for cost tracking.
Add items
Set Cantidad de materiales to the number of distinct materials needed. For each row, select a material and enter the required quantity. A real-time stock indicator shows availability in the selected project and in total.
Automatic stock reservation
Immediately after theRequirement row is inserted, create_requirement() iterates over each item and calls:
RequirementItem is then set to one of two statuses:
| Item status | Meaning |
|---|---|
reserved | reserve_stock() returned True; Inventory.reserved was incremented. |
pending | Insufficient stock at reservation time; the item is waiting. |
Requirement always starts with status = "pending" regardless of item statuses. It advances to partial or fulfilled only when a dispatch is created.
Requirement statuses
| Status | Meaning |
|---|---|
pending | Created; no dispatch has been issued yet. |
partial | At least one dispatch exists but not all requested quantities have been dispatched. |
fulfilled | Every item has been fully dispatched (fulfilled_qty >= requested_qty for all items). |
cancelled | Manually cancelled; all reservations have been released. |
Cancelling a requirement
Requirements with statuspending or partial can be cancelled. Cancellation:
- Iterates over all items with status
reserved. - Calls
release_reservation(db, principal.id, item.material_id, item.requested_qty)for each, decrementingInventory.reserved. - Sets
Requirement.status = "cancelled".
fulfilled cannot be cancelled through the UI.
Auto-reprocessing
Wheneveradd_stock() is called, it triggers reprocess_requirements(db) at the end:
reserved (or fulfilled) are returned by reprocess_requirements() and surfaced as info messages in the Inventory page. The parent requirement status (pending/partial) does not change here — only dispatching advances it.