Removing of child table data

When I am removing any row from Sales order table (items) which is passed from my custom form
its not remove as in proper way.

when i am passing from my custom form its shows 2 records are present

and i am passing these two to Sale order form and shows me correct two records

but when I am remove one item from it like 2nd one its shows me like this

so please give some suggestions. how I will resolve it.
Baljeet Singh

Seems like an issue with your customization. Share your code.

@rmehta ,
sorry for late reply

I am passing the child from my custom doc
frappe.ui.form.on(“abc”, “create_sale_order”, function (frm, doc) {

var so = frappe.model.make_new_doc_and_get_name('Sales Order');

so = locals['Sales Order'][so];
var items = frm.doc.items || [];
//var items = frm.doc.items;
so.customer = frm.doc.customer;
so.selling_price_list = frm.doc.payment_frequency;
so.items = items;  
for (var i = 0; i < items.length; i++) {
    var soi = frappe.model.add_child(so, 'Sales Order Item', "Selling");      
    soi.actual_qty = items[i].actual_qty;
    soi.amount = items[i].amount;
    soi.base_amount = items[i].base_amount;
    soi.base_net_amount = items[i].base_net_amount;
    soi.base_net_rate = items[i].base_net_rate;
    soi.base_price_list_rate = items[i].base_price_list_rate;
    soi.base_rate = items[i].base_rate;
    soi.billed_amt = items[i].billed_amt;
    soi.delivered_by_supplier = items[i].delivered_by_supplier;
    soi.creation = items[i].creation;
    soi.delivered_by_supplier = items[i].delivered_by_supplier;
    soi.delivered_qty = items[i].delivered_qty;
    soi.description = items[i].description;
    soi.discount_percentage = items[i].discount_percentage;
    soi.docstatus = items[i].docstatus;
    soi.doctype = items[i].doctype;
    soi.gross_profit = items[i].gross_profit;
    soi.item_code = items[i].item_code;
    soi.item_name = items[i].item_name;
    soi.modified = items[i].modified;
    soi.modified_by = items[i].modified_by;
    soi.net_amount = items[i].net_amount;


frappe.set_route("Form", "Sales Order",;


Will any one have any idea about it please ?

I have Read your code and i have notice little mistake in that
repalce “Selling” from

this line by field name of your child table in your custom form

ex:- if your child table field name is = items
then var soi = frappe.model.add_child(so, ‘Sales Order Item’, “items”);


let me try about it nad thanks for the reply

I have done it like this, on purchase invoce.

doc.taxes = [];