Overview
Work Order Reprogramming allows you to create new schedule versions of existing work orders while maintaining the link to the original order. Reprogrammed orders (Type 5) inherit key properties from their parent Initial Orders (Type 4) but allow updated schedules, resources, and budgets.Reprogrammed orders maintain a link to the original work order through the
ot_principal field and are sequentially numbered via num_reprogramacion.Reprogramming Model Properties
The OTE model includes specific fields for managing reprogramming:operaciones/models/ote_models.py
ID of the original work order (only set for Type 5 reprogrammed orders)
Sequential reprogramming number (1st reprogram, 2nd reprogram, etc.)
Reprogramming Detection Properties
Two computed properties help track reprogramming relationships:operaciones/models/ote_models.py
tiene_reprogramaciones
Boolean check if initial order has active reprogrammed versions
count_reprogramaciones
Count of active reprogrammed orders linked to this initial order
These properties only return meaningful data for Initial Orders (Type 4). They filter for active status (
-1 or 1) to exclude logically deleted records.Creating Reprogrammed Orders
The creation process requires linking to an existing Initial Order:operaciones/views/ote.py
Retrieving Initial Orders
To populate the Initial Order selector when creating reprogrammed orders:operaciones/views/ote.py
Response Format
Only active Initial Orders (
id_tipo=4, estatus!=0) are returned, ordered by ID descending to show most recent first.Automatic Step Configuration
Reprogrammed orders use different step templates than initial orders:operaciones/views/ote.py
Type 5 with Client 1
Type 5 with Client 1
Uses step template type
5Type 5 with Clients 2, 3, 4
Type 5 with Clients 2, 3, 4
Uses step template type
18 (alternate client workflow)Type 4 (Initial Orders)
Type 4 (Initial Orders)
Uses step template type
5 (standard workflow)Reprogramming Number Management
During editing, the system validates and manages reprogramming numbers:operaciones/views/ote.py
DataTable Reprogramming Display
The DataTable includes reprogramming status for each work order:operaciones/views/ote.py
ID of parent Initial Order (null for Type 4 orders)
Sequential reprogramming number
Whether this Initial Order has reprogrammed versions
Count of active reprogrammed orders
Historical Import Script
The system includes a comprehensive import script for historical work orders with reprogramming:importar_ot.py
Import Script Key Features
Parent Order Resolution
importar_ot.py
The import script validates that parent orders are Type 4 and exist before creating reprogrammed orders. This prevents orphaned reprogramming records.
PTE Inheritance
Reprogrammed orders inherit the PTE reference from their parent:importar_ot.py
This ensures the entire family of work orders (initial + all reprogrammed versions) remain linked to the same planning document (PTE).
Automatic Sequential Numbering
If no reprogramming number is provided, the system can auto-assign:importar_ot.py
Filtering by Initial Order
The DataTable supports filtering reprogrammed orders by their parent:operaciones/views/ote.py
Filter by work order type:
"4" for initial, "5" for reprogrammedFilter to show only reprogrammed orders of a specific initial order
Best Practices
Always Link to Valid Parent
Always Link to Valid Parent
Verify the Initial Order exists and is active before creating reprogrammed orders. The system will reject orphaned reprogramming attempts.
Use Sequential Numbering
Use Sequential Numbering
Maintain sequential reprogramming numbers (1, 2, 3…) for clear version tracking. The system can auto-generate these if needed.
Preserve Original Context
Preserve Original Context
Reprogrammed orders inherit the PTE reference automatically. Don’t override this unless you have a specific business reason.
Update Schedules Explicitly
Update Schedules Explicitly
While basic info is inherited, always update schedule dates (
fecha_inicio_programado, fecha_termino_programado) to reflect the new plan.Document Reprogramming Reasons
Document Reprogramming Reasons
Use the
comentario field to explain why reprogramming was necessary. This provides valuable audit trail information.Common Reprogramming Scenarios
Weather Delays
Create reprogrammed order with extended dates when offshore work is delayed by weather
Resource Changes
Reprogram when different vessels, crews, or equipment become necessary
Scope Modifications
Create new version when work scope changes require schedule adjustment
Client Requests
Reprogram to accommodate client-requested timeline changes
URL Endpoints
operaciones/urls.py
Next Steps
Work Order Overview
Understand the complete OTE model structure
Scheduling
Learn about timeline and progress tracking
Import Historical Data
Bulk import work orders with reprogramming relationships