> While creating inventory item of type "SERIALIZED_INV_ITEM" in "INV_ON_HOLD" status it gets created in "INV_AVAILABLE" status
> -----------------------------------------------------------------------------------------------------------------------------
>
> Key: OFBIZ-7094
> URL:
https://issues.apache.org/jira/browse/OFBIZ-7094> Project: OFBiz
> Issue Type: Bug
> Components: product
> Affects Versions: Release Branch 13.07, Release Branch 14.12, Trunk, Release Branch 15.12
> Reporter: Aditi Patidar
> Assignee: Pranay Pandey
> Fix For: 14.12.01, Upcoming Branch, 15.12.01, 13.07.04
>
> Attachments: OFBIZ-7094.patch
>
>
> Use Case: When we create a serialized inventory item and the serial number is not provided, it should be created in "INV_ON_HOLD" status to exclude this item from being count in ATP.
> As per the current implementation in service receiveInventoryProduct if status provided is "INV_ON_HOLD" for inventory item of type "SERIALIZED_INV_ITEM" it should not update to "INV_AVAILABLE" but it's not working expectedly. Here is the logic to check for the same:
> {code}
> <if>
> <condition>
> <and>
> <if-compare value="SERIALIZED_INV_ITEM" operator="equals" field="parameters.inventoryItemTypeId"/>
> <if-empty field="parameters.returnId"/>
> </and>
> </condition>
> <then>
> <!-- Retrieve the new inventoryItem -->
> <entity-one entity-name="InventoryItem" value-field="inventoryItem">
> <field-map field-name="inventoryItemId" from-field="currentInventoryItemId"/>
> </entity-one>
> <!-- Don't reset the status if it's already set to INV_PROMISED or INV_ON_HOLD -->
> <if>
> <condition>
> <and>
> <if-compare value="INV_PROMISED" operator="not-equals" field="inventoryItem.statusId"/>
> <if-compare value="INV_ON_HOLD" operator="not-equals" field="inventoryItem.statusId"/>
> </and>
> </condition>
> <then>
> <clear-field field="serviceInMap"/>
> <set field="serviceInMap.inventoryItemId" from-field="currentInventoryItemId"/>
> <set field="serviceInMap.statusId" value="INV_AVAILABLE"/> <!-- XXX set to returned instead -->
> <call-service service-name="updateInventoryItem" in-map-name="serviceInMap"/>
> </then>
> </if>
> </then>
> </if>
> {code}