Skip to main content

system.kanoa.inventory.addModelBomItem(bomInfo, userId)

Adds a new Bill-of-Materials (BOM) line item to an equipment model, or updates an existing one when modelBomId is supplied inside bomInfo. A model BOM entry describes a single component position within the model's catalog-level structure, either a raw part (partId) or a nested child model (childModelId), along with the quantity and unit of measure required at that position. Because partId and childModelId are mutually exclusive, each BOM item represents either a purchased/stocked part or a sub-assembly modeled as its own equipment model, never both.


Parameters

bomInfo Dictionary

- childModelIdIntegerNot required, mutually exclusive with partId
- enabledBooleanNot required
- modelBomIdIntegerNot required, pass to update
- modelIdInteger
- notesStringNot required
- parentBomIdIntegerNot required
- partIdIntegerNot required, mutually exclusive with childModelId
- positionCodeStringNot required
- positionNameStringNot required
- quantityFloat
- uomIdInteger

userId Integer:Id of the user executing the function


Returns

modelBomId Integer
message String None if success


Example

bomInfo = {
'modelId': 1042,
'partId': 8891,
'quantity': 2.0,
'uomId': 1,
'positionCode': 'P1-A',
'positionName': 'Drive Shaft Bearing',
'enabled': True,
'notes': 'Standard replacement bearing for this position'
}
userId = system.kanoa.security.getIDPUserId({'userName': 'SYSTEM'})
modelBomId, message = system.kanoa.inventory.addModelBomItem(bomInfo, userId)
print modelBomId, message