This implementation below worked!
protected virtual void AMProdItem_InventoryID_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e, PXFieldUpdated baseHandler)
{
baseHandler?.Invoke(cache, e);
var row = (AMProdItem)e.Row;
if (row?.InventoryID == null) return;
var item = InventoryItem.PK.Find(Base, row.InventoryID);
if (item == null) return;
var itemExt = PXCache<InventoryItem>.GetExtension<INInventoryItemExt>(item);
// Check if the custom checkbox (UsrAutoGenerateNumberChecker) is not ticked
if (itemExt?.UsrAutoGenerateNumberChecker != true)
{
// If the checkbox is not checked, exit the method without making any changes
return;
}
cache.SetValueExt<AMProdItem.preassignLotSerial>(row, true);
}