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
| - childModelId | Integer | Not required, mutually exclusive with partId |
| - enabled | Boolean | Not required |
| - modelBomId | Integer | Not required, pass to update |
| - modelId | Integer | |
| - notes | String | Not required |
| - parentBomId | Integer | Not required |
| - partId | Integer | Not required, mutually exclusive with childModelId |
| - positionCode | String | Not required |
| - positionName | String | Not required |
| - quantity | Float | |
| - uomId | Integer |
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