Skip to main content

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

Updates an existing part inventory balance record, which tracks the on-hand, on-order, and reserved quantities for a part at a specific inventory location (asset). Pass a dictionary containing the fields to update, keyed by partInventoryBalanceId, along with the id of the user performing the update. This function is typically called after a physical cycle count, a receiving transaction, or a reservation change to keep quantity-on-hand figures in sync.


Parameters

partInventoryBalanceInfo Dictionary

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

userId Integer:Id of the user executing the function


Returns

# of records modified Integer
message String None if success


Example

partInventoryBalanceInfo = {
'partInventoryBalanceId': 4521,
'partId': 8890,
'inventoryAssetId': 12,
'quantityOnHand': 145.0,
'quantityOnOrder': 50.0,
'quantityReserved': 20.0,
'averageUnitCost': 3.75,
'lastCountedAtUtc': system.date.now()
}
userId = system.kanoa.security.getIDPUserId({'userName': 'SYSTEM'})

recordsModified, message = system.kanoa.inventory.updatePartInventoryBalance(partInventoryBalanceInfo, userId)
print recordsModified, message