TypeError: Cannot read property 'replace' of undefined in custom button

i am trying to add a custom button ‘Delivery Notes’ with some functionality .here is my code

frappe.ui.form.on('Sales Invoice', {
 refresh(frm) {
    console.log(me);
    frm.add_custom_button(__('Delivery Notes'),
        function() {
            erpnext.utils.map_current_doc({
                method: "erpnext.stock.doctype.delivery_note.delivery_note.make_sales_invoice",
                source_doctype: "Delivery Note",
                target: frm,
                date_field: "posting_date",
                setters: [
                    {
                        customer: frm.doc.customer || undefined,
                        project: frm.doc.project || undefined
                    }
                ],
                get_query: function() {
                var filters = {
                    docstatus: 1,
                    company: frm.doc.company,
                    is_return: 0
                };
                if(frm.doc.customer) filters["customer"] = frm.doc.customer;
                if(frm.doc.project) filters["project"] = frm.doc.project;
                return {
                    query: "my_custom_app.my_custom_app.doctype.sales_invoice.sales_invoice_custom.get_delivery_notes_to_be_billed",
                    filters: filters
                };
            }
        });
    }, __("Get items from"));
  }
});

i can see the new custom button. but when i click it shows error as below

please anyone help me on this?

Thanks,
Abrar