Skip to main content

system.kanoa.inventory.addPart(partInfo, userId)

Adds a new part record to the inventory master. This is the primary function for registering a new stock-keeping unit (SKU) such as a bearing, filter, or gasket, into the system, along with its category, unit of measure, manufacturer reference, and handling flags (serialized, consumable, repairable, critical spare). On success the newly created part's id is returned so it can be used immediately in follow-up calls (e.g. updatePart, updatePartField).


Parameters

partInfo Dictionary

- defaultUomIdInteger
- enabledBoolean
- isConsumableBoolean
- isCriticalSpareBoolean
- isRepairableBoolean
- isSerializedBoolean
- manufacturerIdInteger
- manufacturerPartNumberString
- notesString
- partCategoryIdInteger
- partDescriptionString
- partNumberString

userId Integer:Id of the user executing the function


Returns

partId Integer
message String None if success


Example

# Register a new sealed ball bearing as a critical spare part
partInfo = {
'partNumber': '6203-2RS',
'partDescription': '6203-2RS Sealed Ball Bearing, 17x40x12mm',
'partCategoryId': 14,
'manufacturerId': 22,
'manufacturerPartNumber': 'SKF-6203-2RS',
'defaultUomId': 1,
'enabled': True,
'isConsumable': False,
'isCriticalSpare': True,
'isRepairable': False,
'isSerialized': False,
'notes': 'Primary spare for conveyor drive motor bearings'
}
userId = system.kanoa.security.getIDPUserId({'userName': 'SYSTEM'})
newPartId, message = system.kanoa.inventory.addPart(partInfo, userId)
print newPartId, message