Skip to main content

system.kanoa.inventory.addModel(modelInfo, userId)

Adds a new model to the inventory catalog, or updates an existing one when modelId is included in modelInfo. A model represents a specific equipment/asset model made by a manufacturer (e.g. a catalog entry for a pump or motor model), distinct from a Part, which is an individual replaceable component. This upsert behavior is the only mechanism for modifying an existing model as there is no separate updateModel or updateModelField function.


Parameters

modelInfo Dictionary

- assetTypeIdIntegerNot required
- descriptionStringNot required
- enabledBooleanNot required
- manufacturerIdInteger
- modelIdIntegerNot required, pass to update
- modelNumberString
- notesStringNot required

userId Integer:Id of the user executing the function


Returns

modelId Integer
message String None if success


Example

modelInfo = {
'manufacturerId': 42,
'modelNumber': '6205-2RS',
'assetTypeId': 7,
'description': 'Sealed ball bearing',
'notes': 'Standard replacement bearing for conveyor rollers',
'enabled': True
}
userId = system.kanoa.security.getIDPUserId({'userName': 'SYSTEM'})
modelId, message = system.kanoa.inventory.addModel(modelInfo, userId)
print modelId, message