Factorizer/Cluster ERP WikiCluster ERP Türkçe
Home / Business modules

Reference

Work orders

Reference for the work_orders sub-module of production, with work order fields, statuses, generation from orders, start and completion rules, and scheduling fields.

This page describes the work_orders sub-module of src/cluster_erp/modules/production/. A work order (WorkOrder) executes one operation of a production order on one work center for a quantity. Work orders carry planned, scheduled, and actual times; the scheduling board places them on the calendar, as explained on scheduling.

Scope and source

  • Defined in: src/cluster_erp/modules/production/work_orders/models.py (WorkOrder), services.py (WorkOrderService), and routes.py; the generation route is in production_orders/routes.py.
  • Count: 1 table, 8 routes in routes.py plus the generation route (@router. decorators).

Work order fields

Name Meaning Source
wo_no Business key from the yearly sequence work_order src/cluster_erp/modules/production/work_orders/models.py:20, src/cluster_erp/modules/production/work_orders/services.py:184
production_order_id, production_order_operation_id, work_center_id The order, its operation, and the work center src/cluster_erp/modules/production/work_orders/models.py:26-40
qty, qty_completed, qty_scrapped Quantities src/cluster_erp/modules/production/work_orders/models.py:41-51
status Default pending src/cluster_erp/modules/production/work_orders/models.py:52-56
planned_start, planned_end Planned window src/cluster_erp/modules/production/work_orders/models.py:57-58
scheduled_start, scheduled_end, calendar_stale_at, schedule_locked Board placement, stale mark after a calendar change, and lock src/cluster_erp/modules/production/work_orders/models.py:63-82
actual_start, actual_end, assigned_employee_id, notes Execution record src/cluster_erp/modules/production/work_orders/models.py:83-93

Statuses

The service allows these transitions (src/cluster_erp/modules/production/work_orders/services.py:39-44).

stateDiagram-v2
 [*] --> pending
 pending --> in_progress: start
 pending --> cancelled: cancel
 in_progress --> completed: complete
 in_progress --> cancelled: cancel

In prose: a work order waits as pending, runs as in_progress, and ends completed or cancelled. Only pending work orders are schedulable on the board (src/cluster_erp/modules/production/scheduling/services.py:321-329).

Routes

Method and path Permission Source
GET, POST /work-orders/; GET, PUT, DELETE /work-orders/{work_order_id} work_order.read, .create, .update, .delete src/cluster_erp/modules/production/work_orders/routes.py:26-97
POST /work-orders/{work_order_id}/start, /complete, /cancel work_order.update src/cluster_erp/modules/production/work_orders/routes.py:112-144
POST /production-orders/{order_id}/generate-work-orders work_order.create src/cluster_erp/modules/production/production_orders/routes.py:102

Constraints and validation

  • Work orders can be created only while the order is planned, released, or in_progress; the operation row is locked so that two creates cannot over-dispatch the order (src/cluster_erp/modules/production/work_orders/services.py:46-47, src/cluster_erp/modules/production/work_orders/services.py:160-200).
  • Generation creates one work order for each operation that has none, for the lot quantity; finer splits are made by hand (src/cluster_erp/modules/production/work_orders/services.py:205-247).
  • Starting a work order sets the operation to in_progress and a released order to in_progress (src/cluster_erp/modules/production/work_orders/services.py:325-355).
  • Completion refuses a completed plus scrapped quantity above the work order quantity, then emits WorkOrderCompleted (src/cluster_erp/modules/production/work_orders/services.py:367-412).
  • Only pending or cancelled work orders can be deleted (src/cluster_erp/modules/production/work_orders/services.py:305-315).
  • A working calendar change stamps calendar_stale_at on scheduled work orders computed against it (src/cluster_erp/modules/production/module.py:1119-1138).

Terms introduced

Term Code identifier Definition Turkish term Source
schedule lock schedule_locked A flag that keeps a work order out of automatic scheduling. Çizelge kilidi src/cluster_erp/modules/production/work_orders/models.py:77-82
calendar stale mark calendar_stale_at The time a work order's schedule became outdated by a calendar change. Takvim bayatlık işareti src/cluster_erp/modules/production/work_orders/models.py:73-76

Verified against commit 92f8051 on 2026-11-13.

Verified against commit 92f8051 · 2026-11-13