How to make the calculations automatically

frappe.ui.form.on('Sales Invoice', {
    refresh: function(frm) {
        frm.add_custom_button(__('Issue'), function(){
            new frappe.ui.form.MultiSelectDialog({
                doctype: "Issue",
                target: frm,
                setters: {},
                get_query() {
                    return {
                        filters: { status: 'Closed' }
                    }
                },
                action(selections) {
                    if (selections && selections.length > 0) {
                       $.each(selections, function (i,custom_item) {
                           console.log(custom_item);
						  frappe.db.get_list('Issue', {
								fields: ['customer','custom_item.itemss','custom_item.qty'],
								filters: {"name":custom_item}
							}).then(records => {
							   console.log(records);
							   frm.set_value("customer",records[0].customer)
							    frm.clear_table("items");
								frm.add_child("items",{
								  item_code: records[0].itemss,
								  qty:records[0].qty
								});
							   frm.refresh_field("items");
							   frm.refresh_field("customer");
							})
						});
                        $(".modal").modal("hide");
                    }
                }
            });
        }, __("Get Items From"));
    }
});

After getting the items and qty which is automatically bind the calculations is not taking place

Please read the whole post.

You have to use the frappe.model.set_value

frappe.ui.form.on('Sales Invoice', {
    refresh: function(frm) {
        frm.add_custom_button(__('Issue'), function(){
            new frappe.ui.form.MultiSelectDialog({
                doctype: "Issue",
                target: frm,
                setters: {},
                get_query() {
                    return {
                        filters: { status: 'Closed' }
                    }
                },
                action(selections) {
                    if (selections && selections.length > 0) {
                       $.each(selections, function (i, custom_item) {
                           console.log(custom_item);
                           frappe.db.get_list('Issue', {
                                fields: ['customer','custom_item.itemss','custom_item.qty'],
                                filters: {"name": custom_item}
                            }).then(records => {
                                console.log(records);
                                frm.set_value("customer", records[0].customer);
                                frm.clear_table("items");
									// frm.add_child("items",{
								//   item_code: records[0].itemss,
								//   qty:records[0].qty
								// });
                                let row = frm.add_child("items");
                                frappe.model.set_value(row.doctype, row.name, "item_code", records[0].itemss);
                                frappe.model.set_value(row.doctype, row.name, "qty", records[0].qty);
                                frm.refresh_field("items");
                            }).catch(err => {
                                console.error(err);
                            });
                        });
                        $(".modal").modal("hide");
                    }
                }
            });
        }, __("Get Items From"));
    }
});