Add

[POST] .../v1/docproduction/add

Creates a new production document. Use this method to create an assembly or disassembly production document before locking it and adding produced item rows with ProductionOperation/Add. The request body must contain type, date and stock_id; description is optional, the document code is generated by the database and attached_user_id is accepted by the request model but is not stored by the current persistent implementation. Production must be enabled, the document date must not fall into a closed period for the stock company and the current request user must have production document add permission. Missing body, disabled production, invalid type or date, closed-period conflicts, denied access, unavailable tariff, foreign-key failures, database failures or webhook failures are returned as HTTP 200 ErrorResult business errors.

Request Parameters

Name Type Required Description
attached_user_id Int64 Optional Responsible user ID. Currently accepted; this method does not store the responsible user.
date Int64 Required Production document date as Unix time.
description String Optional Note. Maximum length is 300 characters.
stock_id Int64 Required Stock ID.
type String Required Production document type: Assemblable - assembly, Disassemblable - disassembly. Allowed values: Default, Assemblable, Disassemblable.

Request Example

{
  "type": "Assemblable",
  "date": 1767312000,
  "stock_id": 3,
  "description": "Assembly run for gift sets"
}

Response Parameters

Name Type Description
ok Boolean Indicates whether the request completed successfully.
result Insert Created record result.

Response Example

{
  "ok": true,
  "result": {
    "new_id": 7401
  }
}