Docs menu

Production

Read Conventions first.

production_boms

One BOM per product item.

  • id, business_id, product_item_id → items - UNIQUE (business_id, product_item_id)
  • warehouse_id, price_list_id nullable
  • planned_production_qty numeric(14,4) DEFAULT 1
  • product_price numeric(14,2)
  • distribution_rule, project - free text, not FKs
  • created_by, created_at, updated_at

production_bom_lines

Standard cost is not stored - computed live from the component’s default_purchase_price.

  • id, production_bom_id CASCADE, line_no int
  • component_item_id → items NOT NULL
  • quantity, additional_quantity numeric(14,3)
  • warehouse_id, price_list_id nullable; unit_price numeric(14,2) (denormalized)
  • issue_method CHECK IN (‘manual’,‘backflush’)
  • comments, created_at

production_orders

  • id, business_id, document_no - UNIQUE (business_id, document_no)
  • branch_id NOT NULL
  • order_type DEFAULT ‘standard’ - CHECK IN (‘standard’,‘disassembly’); disassembly inverts which side Issue/Receipt act on
  • product_item_id NOT NULL, production_bom_id NOT NULL, warehouse_id NOT NULL
  • planned_quantity numeric(14,3) NOT NULL
  • product_quantity_done - standard: product received so far; disassembly: product issued (torn down) so far
  • due_date, remarks
  • status CHECK IN (‘draft’,‘posted’,‘closed’,‘cancelled’)
  • posted_at/posted_by, created_by, created_at

production_order_lines

Snapshot of the BOM, scaled by planned_quantity / production_boms.planned_production_qty.

  • id, production_order_id CASCADE, line_no int, component_item_id NOT NULL
  • planned_quantity numeric(14,3)
  • quantity_done - standard: issued so far; disassembly: received back so far
  • warehouse_id, issue_method CHECK IN (‘manual’,‘backflush’), row_status CHECK IN (‘open’,‘closed’)
  • created_at

production_issues / production_issue_lines

  • production_issues - id, business_id, document_no UNIQUE (business_id, document_no); branch_id NOT NULL, production_order_id NOT NULL, issue_date, remarks; status CHECK IN (‘draft’,‘posted’,‘cancelled’); posted_at/posted_by, created_by, created_at
  • production_issue_lines - id, production_issue_id CASCADE; source_order_line_id → production_order_lines RESTRICT NULL - NULL means “this line is the order’s own product” (the disassembly case); item_id NOT NULL, warehouse_id NOT NULL, quantity, unit_cost, line_total, cost_center_id, created_at

production_receipts / production_receipt_lines

  • production_receipts - same shape as production_issues with receipt_date; UNIQUE (business_id, document_no)
  • production_receipt_lines - mirror of production_issue_lines, plus batch/serial capture. id, production_receipt_id CASCADE, source_order_line_id NULL (NULL = receives the order’s own product); item_id, warehouse_id, quantity, unit_cost, line_total; batch_number, expiry_date, serial_numbers, admission_date; cost_center_id, created_at