Budgets (presupuestos) represent construction projects in Sistema MRP. Each budget defines the financial envelope for a project and acts as the reference point for linking inventory records and requirements, calculating dispatched material costs, and tracking expenditure against plan.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.
What is a project?
A project is aBudget record in the database (models/budget.py). Its fields are:
| Field | Type | Description |
|---|---|---|
name | string | Human-readable project name. |
budget_soles | float | Allocated budget in Peruvian soles (S/.). |
budget_dolares | float | Allocated budget in US dollars ($). |
notes | string | Optional free-text description or scope notes. |
is_active | boolean | Whether the project is currently active. |
is_finished | boolean | True after finish_budget() is called. |
finished_at | datetime | Timestamp set when the project is finished; None otherwise. |
created_at | datetime | When the project was created. |
budget_soles and budget_dolares can be set independently. Projects can carry a soles-only budget, a dollars-only budget, or both simultaneously.
Creating a project
Open the registration form
On the Presupuestos page, expand the Registrar nuevo presupuesto section.
Enter the project name
Type a descriptive name in the Nombre del proyecto field (required). Example:
Obra Residencial Norte 2025.Set the budget amounts
Enter the allocated amount in Presupuesto (S/.) and/or Presupuesto ($). Both default to
0. At least one should be set to a positive value to enable budget-utilization tracking.Add notes (optional)
Use the Notas field to record the project description, scope, or any relevant details.
Linking inventory and requirements to a project
Both theInventory and Requirement models have a budget_id foreign key. When a client creates an inventory record in their principal warehouse or raises a requirement, they can associate it with a specific project by setting this field.
This linkage is what determines which inventory records are frozen when a project is deleted, and which requirements are cancelled automatically. It also controls how dispatched materials are attributed to a project for cost tracking.
Tracking costs
get_dispatch_costs(db, since, until) in services/budget_service.py calculates material expenditure for a given time range. For each material that appears in any dispatch within the range, it computes:
since=bud.created_at to scope costs to each project’s lifetime.
A progress bar on each project card shows how much of the soles and dollar budgets have been consumed. The bar turns amber above 70% utilization and red above 90%.
Material unit prices are configured on the Materiales page, not on the budget itself. If a material has no unit price set, its cost contribution shows as S/ 0.00. Make sure all materials used on a project have their
unit_price and/or unit_price_dolares fields filled in.Finishing a project
Clicking Finalizar obra on a project card callsfinish_budget(db, budget_id), which:
Deleting a project
Clicking Eliminar on a project card triggers a confirmation prompt that also shows how many active inventory records are linked to the project. Confirming callsdelete_budget(db, budget_id), which:
- Cancels all
pendingandpartialrequirements linked to the project (Requirement.budget_id == budget_id). - Sets
is_active = Falseon all linkedInventoryrecords (freezing them). - Deletes the
Budgetrecord.
Frozen inventory records are not lost. The client can redirect them to a different active project from their Inventario Principal page, which restores the records to active status under the new project.
Reactivating a finished project
reactivate_budget(db, budget_id) reverses finish_budget:
is_finished == True. After reactivation, the project returns to active status and can receive new requirements and inventory records.