Purchase Taxes and Charges child table for Custom Doctype

Hi,

I have created one doctype called Sub Contract Order. There I have added a tax template field (link to Purchase Taxes and Charges template in option) and Also added one table (option Purchase Taxes and Charges child table ).

My Problem:
Its not fetching like in PO.
This is my code…

frappe.ui.form.on(‘Sub Contract Order’, {
taxes_and_charges: function (frm) {
if (frm.doc.taxes_and_charges) {
frappe.call({
method: ‘frappe.client.get_value’,
args: {
doctype: ‘Purchase Taxes and Charges Template’,
filters: {
name: frm.doc.taxes_and_charges
},
fieldname: [‘taxes’]
},
callback: function (r) {
if (r.message && r.message.taxes) {
var taxes = r.message.taxes;
frm.set_value(‘taxes’, );
$.each(taxes, function (index, tax) {
frm.add_child(‘taxes’, {
charge_type: tax.charge_type,
account_head: tax.account_head,
rate: tax.rate,
tax_amount: tax.tax_amount,
total: tax.total
});
});
frm.refresh_field(‘taxes’);
}
}
});
} else {
frm.set_value(‘taxes’, );
}
}
});