Filter Inventory Dimension values based on stock data

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

Found the solution in this answer