Hi,
I have a child table (Delivered Services)with three fields:
- Invoice (link field - links to Invoice doctype)
- Amount (currency field)
- Hours (float field)
The Invoice field has two fields:
- total_amount (currency field)
- total_hours (float field)
Whenever i select an invoice for a table row, I want to fetch the amount and hours field data from the selected Invoice. i.e hours field in table should have the total_hours value of selected invoice and amount field in table should have the total_amount value of selected invoice. Each row will have its respective selected Invoice.
I have written a custom script on the Parent Doctype (Plan) for the child doctype (Delivered Services). Now Invoice is not the parent for delivered services, it is a simple doctype, the parent is Plan. However my app does not fetch the values. Any help is appreciated, my code is as follows:
frappe.ui.form.on(‘Delivered Services’, {
refresh(frm) {
cur_frm.add_fetch(‘invoice’,‘invoice.total_hours’,‘hours’)
}
})
where:
1.invoice is the link field in the child table (linking to invoice doctype).
2. invoice.total_hours is the float field in the invoice doctype.
3. hours is the float field in the child doctype.