Skip to main content

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.

A receipt is the final step in the MRP cycle. It confirms that the materials included in a dispatch have physically arrived at the obra warehouse. Confirming a receipt increments the obra warehouse’s Inventory.stock for each dispatched material and writes an IN movement record.

What a receipt confirms

A receipt is always linked to exactly one dispatch via Receipt.dispatch_id. The create_receipt() service uses the dispatch’s items directly — no separate item selection is needed:
  • For each DispatchItem, it calls get_or_create_inventory() for the obra warehouse, scoped to the same project as the requirement (budget_id, budget_name).
  • Inventory.stock += dispatched_qty is applied to the obra warehouse record.
  • A Movement(movement_type="IN", reference_type="receipt", reference_id=receipt.id) is written for each material.
Each dispatch can only have one receipt. Attempting to confirm a receipt for a dispatch that already has one returns (False, "Este despacho ya fue recibido").

How to register a receipt

1

Open the Receipts page

Navigate to Recepciones in the sidebar. Only dispatches that have not yet been received appear in the selector.
2

Select the dispatch

Choose the dispatch from the Selecciona despacho dropdown. The selector shows the Guía de Remisión number and dispatch date.
3

Review the materials

The page lists each material in the dispatch with quantity, unit, and unit price. Materials with dispatched_qty = 0 are shown in grey as already received.
4

Confirm

Click Confirmar Recepción. The service call is:
create_receipt(db, dispatch_id, user_id=owner_id)
# Returns (True, "Recepción registrada correctamente") or (False, error_message)

What happens after receipt

EffectDetail
Obra stock increasesInventory.stock += dispatched_qty on the obra warehouse record, scoped to the requirement’s project
IN movement recordedMovement(movement_type="IN", reference_type="receipt") per material
Dispatch marked receivedThe dispatch gains a Receipt relation; it moves to the Historial de Recepciones view
The receipt does not change any field on the Requirement or its items — status changes on the requirement happen only during dispatch creation.

Receipt history

Completed receipts appear in the Historial de Recepciones section with filters by obra, project, date range, and guia number. The history can be exported as CSV using the Descargar CSV button.
All receipt_date timestamps are recorded in Lima/Peru time (UTC-5, no daylight saving time). The offset is applied in receipt_service.py via:
_LIMA = timezone(timedelta(hours=-5))

def _now_lima() -> datetime:
    return datetime.now(_LIMA).replace(tzinfo=None)
The receipt history card also displays "hora Lima (UTC-5)" alongside the receipt date to make the timezone explicit.

Build docs developers (and LLMs) love