Salam,
On erpnext: 14.8.0, frappe: 14.16.0, hrms: 1.0.0, payments: 0.0.1
I have created doctype like Return Record how to get item price (rate) on child table “Return Item” based on customer selection
Its work but discount not applied based on customer selection on main doctype
You can add the custom logic in the script according to your scenairo.