Uncaught TypeError: Cannot convert undefined or null to object

when i am click this button
then i faced this problem

but actually i dont understand what’s wrong with my code ? please help for me anyone on this purpose .

this my code

This Js code

frappe.ui.form.on("Bill of Entry or Export",{
	refresh:function (frm) {
		if (frm.doc.docstatus == 0) {
				function() {
						method: "garments.commercial.doctype.commercial_invoice.commercial_invoice.get_items_for_bill_of_entry",
						source_doctype: frm.fields_dict.invoice.df.options
						/*get_query_filters: {
						docstatus: 1
			}, __("Get items from"));

This Py code

def get_items_for_bill_of_entry(source_name, target_doc=None):
	doc = get_mapped_doc("Commercial Invoice", source_name,	{
		"Commercial Invoice": {
			"doctype": "Bill of Entry or Export"
		"Commercial Invoice Child": {
			"doctype": "Commercial Invoice Child"
	}, target_doc)

	return doc

Why are you mapping draft document? you can refer below code from quotation.js. Check make_sales_order method from quotation.py also

Now i am facing this fatal error

Refer given code, use print and console.log to debug it.