Help on script to populate target warehouse in items list

If a stock entry details list is created from a BOM the target warehouse in each of the items in the items list does not populate based on the default target warehouse of the form. I wish to create a script to do this. The script will be part of the Stock Entry form and needs to set values in the Stock Entry Details form (some_object.t_warehouse).

Help on an iterator syntax and identification of the object names to do the job will be appreciated. I plan to trigger the script on a custom button in the Stock Entry form.

@davidgal please file this at - we will fix it in a day or so.