Filter Inventory Dimension values based on stock data

Set up

We have created Inventory Dimensions named Rack. When adding Purchase Receipt, we set the Rack value for every document.

What we need

How do we limit the Rack list to only show those Racks where the Item was actually stored during Purchase Receipt?

We’re having trouble in setting the Inventory Dimension mandatory for all stock transactions except for POS Invoice.

Here’s the screenshot of the created dimension:

What is the correct way to make the Rack Inventory Dimension mandatory for all documents except for POS Invoice?

Using frm.fields_dict['items'].grid.update_docfield_property('rack','reqd', 1) to solve the problem.

Found the solution in this answer

I have tried to make the same but I can’t get the info from the inventory dimension table. According to my current knowledge the information is only stored at the stock entry. In general it would be nice in all the warehouse lists to get the places first where already items are stocked.

Can you maybe explain a bit more in detail how you solved the issue to get only the list entries shown where the item is stocked?