Set value in child table of DocType

I created one custom doctype named Partial Shipping Slip. I wrote a custom script, the script loads some fields and child table field on select of sales order. The script is as follows:
cur_frm.add_fetch(“sales_order”, “customer”, “customer”);
cur_frm.add_fetch(“sales_order”, “customer_name”, “customer_name”);

frappe.ui.form.on(“Partial Shipping Slip”, “sales_order”, function(frm) {
frappe.model.with_doc(“Sales Order”, frm.doc.sales_order, function() {
var tabletransfer= frappe.model.get_doc(“Sales Order”, frm.doc.sales_order)
$.each(tabletransfer.items, function(index, row){
d = frm.add_child(“item”);
d.item_code = row.item_code;
d.item_name = row.item_name;
d.description = row.description;
d.uom = row.uom;
d.stock_qty = row.stock_qty;
d.item_name = row.item_name;
d.rate = row.rate;
d.previous_qty= 0;
d.amount = row.amount;

It is working fine, no issues. But My child tables contains three fields,
previous qty, current qty and total qty.
Previous qty , I have taken as 0 in above script.
Current qty, I want to fill manualy,
Total qty should be automatically displayed as previous qty + current.

I am not able to figure out where and what to write the script. Plz help

look at this exmple

1 Like

It worked for me…