Custom Fields on Purchase receipt

right now when we add items to the stock we make purchase receipt and we have to edit edit each item row in order to select the warehouse and cost center. it is some time. time taking where are a lot of items are in item table and some times the cost center field is not chosen by the user and it makes room for false entry. to encounter this situation we have made two custom fields on purchase receipt doc-type one for cost center and the other is for warehouse and made it mandatory. now we want to link these custom field to each item added in item table.

we know we can use this custom script but dont know how
cur_frm.add_fetch(link_field, source_fieldname, target_fieldname);

@neilLasrado bro need your help if you can. thanks