Skip to main content

system.kanoa.inventory.addPartInventoryBalance(partInventoryBalanceInfo, userId)

Adds a new part inventory balance record for a given part and inventory asset (e.g. a warehouse, bin, or storeroom location). The partInventoryBalanceInfo dictionary carries the on-hand, on-order, and reserved quantities along with the average unit cost and the timestamp of the last physical count. Returns the id of the newly created balance record.


Parameters

partInventoryBalanceInfo Dictionary

- averageUnitCostFloat
- inventoryAssetIdInteger
- lastCountedAtUtcDateTime
- partIdInteger
- quantityOnHandFloat
- quantityOnOrderFloat
- quantityReservedFloat

userId Integer:Id of the user executing the function


Returns

partInventoryBalanceId Integer
message String None if success


Example

# Record an initial inventory balance for a bearings part at the main warehouse
partInventoryBalanceInfo = {
'partId': 231,
'inventoryAssetId': 4,
'quantityOnHand': 150.0,
'quantityOnOrder': 25.0,
'quantityReserved': 10.0,
'averageUnitCost': 12.75,
'lastCountedAtUtc': system.date.now()
}
userId = system.kanoa.security.getIDPUserId({'userName': 'SYSTEM'})
partInventoryBalanceId, message = system.kanoa.inventory.addPartInventoryBalance(partInventoryBalanceInfo, userId)
print partInventoryBalanceId, message