Under what conditions can a location be deleted/inactivated?
A location cannot be deleted if it currently has stock quantity, transaction history, or is assigned to any stock items or location groups. Even if the location is completely unassigned to all items and contains no stock quantities, if it has ever been used in a previous transaction then it cannot be deleted.
That said, if the location currently contains no stock quantities and is not current assigned to any stock items or location groups, then it can be inactivated by unchecking its 'Active' checkbox in the Locations screen, even if it has had previous transaction history to/from it.
The above information covers the rules regarding deleting/inactivating locations. That said, though, it can sometimes be difficult to determine whether or not a location meets (or fails to meet) the restrictions mentioned above. So, the remainder of this article will discuss how to investigate each:
1) To determine whether or not a location currently has on-hand stock quantity, use (Inventory > Data Views > Stock On Hand). Each option on the presented filter should have "both" or "all" checked, except for Location. For Location, be sure to select the specific location that you're investigating.
2) To determine whether or not a location has previous transaction history, use (Inventory > Data Views > Inventory Transactions Detail). On the opening filter screen, select a date range that is extremely large to make sure and grab all data. You may just choose a From year of 2000 and a To year of 2100, just to be sure. For location, select the location that you're investigating. For transaction type, choose 'All'.
3) To determine whether or not a location is currently assigned to any location groups, go to (Inventory > Inventory Setup > Locations), highlight the location in question and flip to the 'Location Groups' tab. There, you'll see if the location is assigned to any location groups and you can also remove the assignment using the 'Remove' button.
4) To determine whether or not a location is currently assigned to any items, it will require a two step process:
First, you need to determine whether or not the location is currently a Primary or Receipt location for any items. This is best investigated under (Inventory > Data Views > Stock Items List). Make sure to 'Include Custom Items' and that Status is set to 'Both'. For the layout selection, choose 'All Fields (SYSTEM)'. You should then see the grid with columns for Primary Location and Receipt Location. You can sort on those columns to determine if (and for which items) the location is currently as assigned as either Primary Location or Receipt Location. If you find any, you'll need to remove that assignment under (Inventory > Stock Items > Locations tab).
Next, you need to determine whether or not the location is currently, individually Assigned to any items. This is more difficult than the previous investigations. To do this, go to (Utilities > Database Queries) and copy/paste the following statement into the SQL box:
select * from ITEM_LOCATIONS where LOCID = 'LOCATIONNAMEHERE'
After pasting the above statement into the SQL box, highlight the LOCATIONNAMEHERE value and replace it with the actual name of the location that you're investigating. Leave the single-quote marks around it! Click OK and the spreadsheet should populate showing a listing of any items that currently have this location assigned. You can remove those assignments under (Inventory > Stock Items > Locations tab > 'Assign by Location' radio button) using the '-' button at the bottom. If you receive the error "At least one additional location is required." then you may need to select the 'None' radio button prior to leaving the screen. Eventually, we plan to add an "Individually Assigned" tab to the (Inventory > Inventory Setup > Locations) screen to locate these assignments without having to interact with the Database Queries module.