Đơ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 from the KiotViet platform. It allows users to create new purchase orders, retrieve existing ones by ID or as a list, update orders, and cancel them. This is useful for automating inventory procurement workflows, syncing order data between KiotViet and other systems, or managing supplier orders programmatically.

Practical examples include:

  • Automatically creating purchase orders when stock levels fall below a threshold.
  • Fetching details of a specific purchase order to verify status or contents.
  • Listing all purchase orders within a date range or filtered by status.
  • Updating an existing purchase order with new product quantities or prices.
  • Canceling a purchase order that is no longer needed.

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 The unique identifier of the purchase order (required for get, update, cancel operations).
Lấy Toàn Bộ (returnAll) Whether to return all purchase orders or limit the number of results (for getAll operation).
Giới Hạn (limit) Maximum number of purchase orders to return when not returning all (getAll operation).
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).
Chi Tiết ĐƠN HÀNG (orderDetails) Details of products in the order including product ID, quantity, and price (for create and update).
Trường Bổ Sung (additionalFields) Additional optional fields such as description and discount (for create and update).
Bộ Lọc (filters) Filters to apply when listing purchase orders, e.g., status, creation date range (getAll).

Output

The node outputs JSON data representing purchase order information returned from KiotViet API calls. Depending on the operation:

  • Create: Returns the newly created purchase order details.
  • Get by ID: Returns the details of the specified purchase order.
  • Get All: Returns a list of purchase orders matching filters and limits.
  • Update: Returns the updated purchase order details.
  • Cancel: Returns a success confirmation object { success: true }.

No binary data output is produced by this node.

Dependencies

  • Requires an API key credential for authenticating with the KiotViet API.
  • The node uses an internal KiotViet API client class to interact with purchase order endpoints.
  • Proper configuration of the API credential in n8n is necessary for successful requests.

Troubleshooting

  • Invalid or missing purchase order ID: Ensure the "ID ĐƠN ĐẶT HÀNG" property is provided and correctly formatted as a string representing a numeric ID for get, update, or cancel operations.
  • API authentication errors: Verify that the API key credential is valid and has sufficient permissions.
  • Empty or malformed order details: When creating or updating, ensure product IDs, quantities, and prices are correctly set and numeric.
  • Rate limiting or network issues: Handle transient API errors by enabling "Continue On Fail" to prevent workflow interruption.
  • Filter misconfiguration: For getAll operation, ensure filter dates are in YYYY-MM-DD format and status values match allowed options.

Links and References

Discussion