ERPNext Connector - Item Update
This document describes the process for synchronizing item data from ERPNext to the App4Sales platform. The connector retrieves item master data, pricing information, and stock levels from the ERPNext API and updates the corresponding entities in App4Sales.
Data Source Configuration
The connector retrieves data from the following ERPNext API endpoints (also called DocTypes):
Item: Retrieves the main item data. The route for this is
/api/resource/Item.Item Price: Fetches item prices. The route for this is
/api/resource/Item Price.Price List: Used to retrieve all the available price lists. The route for this is
/api/resource/Price List.Bin: Retrieves stock information. The route for this is
/api/resource/Bin.
Authentication is done using a token-based authentication (TBA) or simple username and password, depending on the connector settings.
Data Mapping
Items
App4Sales Field | Source Field (API) | Logic/Notes |
ItemCode | item_code | Direct mapping. |
Description | name | Direct mapping. |
EanCode | barcode | Direct mapping. |
LastAvailableStock | inner_qty | Mapped from the 'inner_qty' field. See Stock & Availability for more details. |
Unit | sales_uom | Direct mapping. |
Item Categories
The following fields from the ERPNext Item are mapped to App4Sales Item Categories.
App4Sales Category Name | Source Field (API) | Logic/Notes |
Brand | brand | Direct mapping. |
CountryOfOrigin | country_of_origin | Direct mapping. |
IsPurchaseItem | is_purchase_item | The value (0 or 1) is converted to a string. |
IsSalesItem | is_sales_item | The value (0 or 1) is converted to a string. |
Material | material | Direct mapping. |
Weight | net_weight | Direct mapping. |
WeightPerUnit | weight_per_unit | Direct mapping. |
ItemGroup | item_group | Direct mapping. |
Domain Specifics
Price Logic
The connector fetches all enabled price lists from ERPNext. For each price list, it retrieves the associated item prices.
App4Sales Field | Source Field (API) | Logic/Notes |
Name | name | Direct mapping from the PriceList DocType. |
Currency | currency | Direct mapping from the PriceList DocType. |
App4Sales Field | Source Field (API) | Logic/Notes |
ItemCode | item_code | Direct mapping from the Item Price DocType. |
Price | price_list_rate | Direct mapping from the Item Price DocType. |
PriceListId | price_list | The name of the price list is used to link to the App4Sales PriceList. |
The connector also supports live price requests, which calculate prices based on pricing rules in ERPNext. These rules can apply direct prices or discounts based on the customer, item, and quantity.
Image Handling
The image field in the Item DocType contains the path to the item's image. The connector maps this to the App4Sales item's image.
Stock & Availability
The main item synchronization sets the LastAvailableStock from the inner_qty field on the Item DocType. Additionally, live stock lookups can be performed. When a live stock request is made, the connector queries the Bin DocType using the item code and the warehouse specified in the WarehouseForStock setting. The following fields are returned:
AvailableStock: Mapped from
actual_qtyQuantityOrderedSales: Mapped from
ordered_qtyToBeDelivered: Mapped from
reserved_qty
Related Settings & Prerequisites
The following settings can influence the item synchronization process:
WarehouseForStock: Specifies the warehouse code to use for live stock lookups.
Known Limitations
The connector does not appear to handle matrix/variant items explicitly. All items are treated as standard items.
There is no specific logic for handling different units of measure (UoM), other than mapping the
sales_uomfield.