Fetching data to fields in erpnext

I have a field department (type:link ) in purchase order. If I select a department I need this department details auto fill in read only field in purchase order. How I handle this

department field from which module need to autofetch?

@Dhanya_K add the field in purchase order with read only checked. then in the same field there is something called fetch from you write : department.some_field_from_department. where department is the fieldname of Department . in version15 you gonna find a select field to select the variable you want to fetch .


I added link field (department) in purchase Order.I need readonly field “Department Name” in Purchase Receipt. When select a department in purchase order I need to auto fill Department Name in Purchase Receipt.

@Dhanya_K what you saying makes no sense . you are selecting department from purchase order so you fetch department name in same purchase order , why it’s going to purchase receipt ? matter of fact , what purchase receipt ?

How to get department name in purchase receipt from purchase order?

In Purchase receipt which field you need there if you click edit fetch from there you type"purchase_order.department" but fetch from works only when field names both need to same in purchase order and purchase receipt and another thing you can rename the fieldnames by “Custom field” transaction…