Đơn Đặt Hàng KiotViet icon

Đơn Đặt Hàng KiotViet

Quản lý đơn đặt hàng từ KiotViet

Overview

This node manages purchase orders in the KiotViet system. It supports creating new purchase orders, retrieving existing ones by ID or as a list, updating purchase orders, and canceling them. This is useful for automating inventory procurement workflows, syncing order data between KiotViet and other systems, or managing supplier orders programmatically.

Practical examples:

  • Automatically create purchase orders when stock levels fall below a threshold.
  • Retrieve and update purchase orders based on external approval processes.
  • Cancel purchase orders if certain conditions are met in an ERP system.

Properties

Name Meaning
Thao Tác (operation) The action to perform: Create, Cancel, Get by ID, Get All, or Update a purchase order.
ID ĐƠN ĐẶT Hàng (purchaseOrderId) The unique identifier of the purchase order (required for get, update, cancel operations).
Chi Tiết ĐƠN Hàng (orderDetails) Details of products in the order; includes multiple products each with Product ID, Quantity, and Price. Used in create and update operations.
Trường Bổ Sung (additionalFields) Additional optional fields for the order such as Description (notes) and Discount amount. Used in create and update operations.
ID Chi Nhánh (branchId) Branch ID where the purchase order is created (required for create operation).
ID Nhà Cung Cấp (supplierId) Supplier ID for the purchase order (required for create operation).
Lấy Toàn Bộ (returnAll) Boolean flag to return all results or limit the number of results when listing purchase orders (getAll operation).
Giới Hạn (limit) Maximum number of purchase orders to return when not returning all (getAll operation).
Bộ Lọc (filters) Filters for listing purchase orders, including Status (Processing, Completed, Canceled), Created From date, and Created To date (getAll operation).

Output

The node outputs JSON data representing purchase orders or operation results:

  • For create, get, getAll, and update operations, it returns purchase order objects with their details, including product lines and additional fields.
  • For cancel operation, it returns a simple success confirmation object { success: true }.
  • If errors occur and "Continue On Fail" is enabled, error messages are returned per item.

No binary data output is produced by this node.

Dependencies

  • Requires an API key credential for authenticating with the KiotViet API.
  • Uses the KiotViet API client internally to perform CRUD operations on purchase orders.
  • No additional environment variables are explicitly required beyond the API credential.

Troubleshooting

  • Invalid or missing purchaseOrderId: When performing get, update, or cancel operations, ensure the purchase order ID is provided and valid.
  • API authentication errors: Verify that the API key credential is correctly configured and has sufficient permissions.
  • Data type mismatches: Product IDs, quantities, prices, branch IDs, and supplier IDs must be numeric strings convertible to integers/floats.
  • Empty product details on create/update: Ensure at least one product with valid details is included in the orderDetails property.
  • Rate limits or network issues: Handle transient API errors by enabling "Continue On Fail" to avoid stopping the entire workflow.

Common error messages will typically relate to invalid parameters, missing required fields, or API connectivity issues. Reviewing the error message and verifying input parameters usually resolves these.

Links and References

Discussion