Add

[POST] .../v1/docorderfrompartner/add

Creates a new order-from-partner document. Use this method to create a customer order header that later receives item rows through OrderFromPartnerOperation/Add and can be converted into a wholesale shipment. The request body must contain date, stock_id, partner_id, currency_id, status_id and vat_calculation_type; status_id must belong to DocOrderFromPartner document type, stock_id must be allowed for the current user, contract_id and booked are optional and description is limited to 300 characters. If attached_user_id is omitted or 0, the API attaches the current request user; for the base currency the API stores exchange_rate = 1, otherwise a positive exchange_rate must fit decimal(18,8) or the currency directory rate is used. The caller must have order-from-partner add permission; missing body, invalid required fields, unavailable tariff, forbidden stock, invalid status type, invalid exchange rate, denied access, 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. If omitted or 0, the API uses the current request user.
booked Boolean Optional Indicates whether the order reserves items.
contract_id Int64 Optional Contract ID. If omitted or 0, the document is created without a contract.
currency_id Int64 Required Currency ID.
date Int64 Required Order-from-partner document date as Unix time in seconds. Negative values are rejected.
description String Optional Document note. Maximum length is 300 characters.
exchange_rate Decimal Optional Exchange rate. For the base currency the API stores 1; for other currencies a positive value must fit decimal(18,8), otherwise the currency directory exchange rate is used.
partner_id Int64 Required Partner ID.
status_id Int64 Required Order-from-partner status ID. The status must belong to DocOrderFromPartner document type.
stock_id Int64 Required Stock ID.
vat_calculation_type String Required VAT calculation mode: No - do not accrue, Exclude - included in the amount, Include - added on top. Allowed values: No, Exclude, Include.

Request Example

{
  "date": 1767225600,
  "stock_id": 101,
  "partner_id": 201,
  "currency_id": 1,
  "status_id": 3,
  "contract_id": 301,
  "booked": true,
  "exchange_rate": 1,
  "vat_calculation_type": "Include",
  "description": "January customer order"
}

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": 4601
  }
}